_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/moveToFile_ctsTomts.ts_0_744 | /// <reference path='fourslash.ts' />
// @module: nodenext
// @allowImportingTsExtensions: true
// @noEmit: true
//@Filename: /src/dir2/bar.mts
////import './blah.ts';
////const a = 2;
// @Filename: /src/dir1/a.cts
////import { b } from './other.cts';
////const p = 0;
////[|const y = p + b;|]
////y;
// @Filename: /src/dir1/other.cts
////export const b = 1;
verify.moveToFile({
newFileContents: {
"/src/dir1/a.cts":
`import { y } from '../dir2/bar.mts';
export const p = 0;
y;`,
"/src/dir2/bar.mts":
`import { p } from '../dir1/a.cts';
import { b } from '../dir1/other.cts';
import './blah.ts';
const a = 2;
export const y = p + b;
`,
},
interactiveRefactorArguments: { targetFile: "/src/dir2/bar.mts" },
});
| {
"end_byte": 744,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_ctsTomts.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddParameterNames5.ts_0_274 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function fn(f: (...number[][][]) => unknown) {}
verify.codeFix({
description: ts.Diagnostics.Add_parameter_name.message,
newFileContent: `function fn(f: (...arg0: number[][][]) => unknown) {}`,
});
| {
"end_byte": 274,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddParameterNames5.ts"
} |
TypeScript/tests/cases/fourslash/fixExactOptionalUnassignableProperties9.ts_0_303 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
// @exactOptionalPropertyTypes: true
//// interface IAny {
//// a?: any
//// }
//// interface J {
//// a?: number | undefined
//// }
//// declare var iany: IAny
//// declare var j: J
//// iany/**/ = j
verify.codeFixAvailable([]);
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixExactOptionalUnassignableProperties9.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalPartialSPan.ts_0_451 | /// <reference path='fourslash.ts' />
////let foo = { bar: { baz: 0 } };
////f/*a*/oo.bar ? foo.bar.baz : "when/*b*/False";
// allow partial spans
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert to optional chain expression",
actionName: "Convert to optional chain expression",
actionDescription: "Convert to optional chain expression",
newContent:
`let foo = { bar: { baz: 0 } };
foo.bar?.baz ?? "whenFalse";`
}); | {
"end_byte": 451,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalPartialSPan.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoSalsaMethodsOnAssignedFunctionExpressions.ts_0_317 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: something.js
////var C = function () { }
/////**
//// * The prototype method.
//// * @param {string} a Parameter definition.
//// */
////function f(a) {}
////C.prototype.m = f;
////
////var x = new C();
////x/*1*/.m();
verify.baselineQuickInfo()
| {
"end_byte": 317,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoSalsaMethodsOnAssignedFunctionExpressions.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalWithBinaryConditionNoNullish.ts_0_373 | /// <reference path='fourslash.ts' />
// @strict: true
////interface Foo {
//// bar:{
//// baz: string | null;
//// }
////}
////declare let foo: Foo;
/////*a*/foo && foo.bar ? foo.bar.baz : "whenFalse";/*b*/
// Do not offer refactor when true condition can be null.
goTo.select("a", "b");
verify.not.refactorAvailable("Convert to optional chain expression") | {
"end_byte": 373,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalWithBinaryConditionNoNullish.ts"
} |
TypeScript/tests/cases/fourslash/formatTrailingComma.ts_0_127 | /// <reference path='fourslash.ts' />
////foo
//// .bar(
//// x,
//// );
verify.formatDocumentChangesNothing();
| {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatTrailingComma.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts_0_223 | /// <reference path='fourslash.ts'/>
////function foo<T>(x: number, callback: (x: T) => number) {
////}
////foo(/*1*/
verify.signatureHelp({ marker: "1", text: "foo(x: number, callback: (x: unknown) => number): void" });
| {
"end_byte": 223,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpInCompleteGenericsCall.ts"
} |
TypeScript/tests/cases/fourslash/constEnumQuickInfoAndCompletionList.ts_0_254 | /// <reference path='fourslash.ts' />
////const enum /*1*/e {
//// a,
//// b,
//// c
////}
/////*2*/e.a;
const text = "const enum e";
verify.completions({ marker: "2", includes: { name: "e", text } });
verify.quickInfos({ 1: text, 2: text });
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/constEnumQuickInfoAndCompletionList.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDeleteUnmatchedParameter1.ts_0_467 | /// <reference path='fourslash.ts' />
// @filename: a.ts
/////**
//// * @param {number} a
//// * @param {number} b
//// */
////function foo() {}
verify.codeFixAvailable([
{ description: "Delete unused '@param' tag 'a'" },
{ description: "Delete unused '@param' tag 'b'" },
]);
verify.codeFix({
description: [ts.Diagnostics.Delete_unused_param_tag_0.message, "a"],
index: 0,
newFileContent:
`/**
* @param {number} b
*/
function foo() {}`,
});
| {
"end_byte": 467,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDeleteUnmatchedParameter1.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts_0_1082 | /// <reference path='fourslash.ts' />
/////**
//// * @param start The start
//// * @param end The end
//// * More text
//// */
////declare function foo(start: number, end?: number);
////
////fo/*1*/
const tags: ReadonlyArray<FourSlashInterface.JSDocTagInfo> = [
{ name: "param", text: [{ kind: "parameterName", text: "start" }, { kind: "space", text: " " }, { kind: "text", text: "The start" }] },
{ name: "param", text: [{ kind: "parameterName", text: "end" }, { kind: "space", text: " " }, { kind: "text", text: "The end\nMore text" }] },
];
verify.noSignatureHelp("1");
edit.insert("o");
verify.noSignatureHelp();
edit.insert("(");
verify.signatureHelp({ parameterDocComment: "The start", tags });
edit.insert("10,");
const help2: FourSlashInterface.VerifySignatureHelpOptions = { parameterDocComment: "The end\nMore text", tags };
verify.signatureHelp(help2);
edit.insert(" ");
verify.signatureHelp(help2);
edit.insert(", ");
edit.backspace(3);
verify.signatureHelp(help2);
edit.insert("12");
verify.signatureHelp(help2);
edit.insert(")");
verify.noSignatureHelp();
| {
"end_byte": 1082,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpWhenEditingCallExpression.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateInterfacePropertyFunctionType.ts_0_369 | /// <reference path="fourslash.ts" />
////interface I {
//// /**/
//// foo: (a: number, b: string) => void;
////}
verify.docCommentTemplateAt("", 11,
`/**
*
* @param a
* @param b
* @returns
*/`);
verify.docCommentTemplateAt("", 11,
`/**
*
* @param a
* @param b
*/`, { generateReturnInDocTemplate: false });
| {
"end_byte": 369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateInterfacePropertyFunctionType.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithOptionalPropertiesGenericDeep.ts_0_484 | /// <reference path="fourslash.ts" />
// @strict: true
//// interface DeepOptions {
//// another?: boolean;
//// }
//// interface MyOptions {
//// hello?: boolean;
//// world?: boolean;
//// deep?: DeepOptions
//// }
//// declare function bar<T extends MyOptions>(options?: Partial<T>): void;
//// bar({ deep: {/*1*/} });
verify.completions({
marker: '1',
includes: [
{
sortText: completion.SortText.OptionalMember,
name: 'another'
},
]
})
| {
"end_byte": 484,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOptionalPropertiesGenericDeep.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarFunctionPrototypeInterlaced.ts_0_3217 | /// <reference path="fourslash.ts"/>
// @Filename: foo.js
////var b = 1;
////function A() {};
////A.prototype.a = function() { };
////A.b = function() { };
////b = 2
/////* Comment */
////A.prototype.c = function() { }
////var b = 2
////A.prototype.d = function() { }
verify.navigationTree({
"text": "<global>",
"kind": "script",
"spans": [
{
"start": 0,
"length": 174
}
],
"childItems": [
{
"text": "A",
"kind": "class",
"spans": [
{
"start": 11,
"length": 122
},
{
"start": 144,
"length": 30
}
],
"nameSpan": {
"start": 20,
"length": 1
},
"childItems": [
{
"text": "constructor",
"kind": "constructor",
"spans": [
{
"start": 11,
"length": 15
}
]
},
{
"text": "a",
"kind": "function",
"spans": [
{
"start": 45,
"length": 14
}
],
"nameSpan": {
"start": 41,
"length": 1
}
},
{
"text": "b",
"kind": "function",
"spans": [
{
"start": 67,
"length": 14
}
],
"nameSpan": {
"start": 63,
"length": 1
}
},
{
"text": "c",
"kind": "function",
"spans": [
{
"start": 119,
"length": 14
}
],
"nameSpan": {
"start": 115,
"length": 1
}
},
{
"text": "d",
"kind": "function",
"spans": [
{
"start": 160,
"length": 14
}
],
"nameSpan": {
"start": 156,
"length": 1
}
}
]
},
{
"text": "b",
"kind": "var",
"spans": [
{
"start": 4,
"length": 5
}
],
"nameSpan": {
"start": 4,
"length": 1
}
},
{
"text": "b",
"kind": "var",
"spans": [
{
"start": 138,
"length": 5
}
],
"nameSpan": {
"start": 138,
"length": 1
}
}
]
}, { checkSpans: true });
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "A",
"kind": "class"
},
{
"text": "b",
"kind": "var"
},
{
"text": "b",
"kind": "var"
}
]
},
{
"text": "A",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "a",
"kind": "function"
},
{
"text": "b",
"kind": "function"
},
{
"text": "c",
"kind": "function"
},
{
"text": "d",
"kind": "function"
}
],
"indent": 1
}
]);
| {
"end_byte": 3217,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarFunctionPrototypeInterlaced.ts"
} |
TypeScript/tests/cases/fourslash/indentationInAssignment.ts_0_948 | /// <reference path="fourslash.ts"/>
//// var v0 = /*4_0*/
//// 1;
////
//// let v1 = 1 /*4_1*/
//// + 10;
////
//// let v2 = 1 + /*4_2*/
//// 1;
////
//// let v3 = 1 + (function /*0_0*/(x: number, y: number) { return x || y; })(0, 1);
////
//// let v4 = 1 + (function (x: number, /*4_3*/y: number) { return x || y; })(0, 1);
////
//// let v5 = 1 + (function (x: number, y: number) { /*4_4*/return x || y; })(0, 1);
////
//// let v6 = 1 + (function (x: number, y: number) { return x || y;/*0_1*/})(0, 1);
////
//// let v7 = 1 + (function (x: number, y: number) {
//// return x || y;/*4_5*/
//// })(0, 1);
////
//// let v8 = 1 + (function (x: number, y: number) { return x || y; })(0, /*4_6*/1);
for (let i = 0; i < 2; ++i) {
goTo.marker(`0_${i}`);
edit.insertLine("");
verify.indentationIs(0);
}
for (let i = 0; i < 7; ++i) {
goTo.marker(`4_${i}`);
edit.insertLine("");
verify.indentationIs(4);
} | {
"end_byte": 948,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentationInAssignment.ts"
} |
TypeScript/tests/cases/fourslash/reverseMappedTypeQuickInfo.ts_0_845 | /// <reference path="fourslash.ts" />
////interface IAction {
//// type: string;
////}
////
////type Reducer<S> = (state: S, action: IAction) => S
////
////function combineReducers<S>(reducers: { [K in keyof S]: Reducer<S[K]> }): Reducer<S> {
//// const dummy = {} as S;
//// return () => dummy;
////}
////
////const test_inner = (test: string, action: IAction) => {
//// return 'dummy';
////}
////const test = combineReducers({
//// test_inner
////});
////
////const test_outer = combineReducers({
//// test
////});
////
////// '{test: { test_inner: any } }'
////type FinalType/*1*/ = ReturnType<typeof test_outer>;
////
////var k: FinalType;
////k.test.test_inner/*2*/
verify.quickInfoAt("1", `type FinalType = {
test: {
test_inner: string;
};
}`);
verify.quickInfoAt("2", `(property) test_inner: string`);
| {
"end_byte": 845,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/reverseMappedTypeQuickInfo.ts"
} |
TypeScript/tests/cases/fourslash/autoImportSpecifierExcludeRegexes1.ts_0_2331 | /// <reference path="fourslash.ts" />
// @module: preserve
// @Filename: /node_modules/lib/index.d.ts
//// declare module "ambient" {
//// export const x: number;
//// }
//// declare module "ambient/utils" {
//// export const x: number;
//// }
// @Filename: /index.ts
//// x/**/
verify.importFixModuleSpecifiers("", ["ambient", "ambient/utils"]);
verify.importFixModuleSpecifiers("", ["ambient"], { autoImportSpecifierExcludeRegexes: ["utils"] });
// case sensitive, no match
verify.importFixModuleSpecifiers("", ["ambient", "ambient/utils"], { autoImportSpecifierExcludeRegexes: ["/UTILS/"] });
// case insensitive flag given
verify.importFixModuleSpecifiers("", ["ambient"], { autoImportSpecifierExcludeRegexes: ["/UTILS/i"] });
// invalid due to unescaped slash, treated as pattern
verify.importFixModuleSpecifiers("", ["ambient", "ambient/utils"], { autoImportSpecifierExcludeRegexes: ["/ambient/utils/"] });
verify.importFixModuleSpecifiers("", ["ambient"], { autoImportSpecifierExcludeRegexes: ["/ambient\\/utils/"] });
// no trailing slash, treated as pattern, slash doesn't need to be escaped
verify.importFixModuleSpecifiers("", ["ambient"], { autoImportSpecifierExcludeRegexes: ["/.*?$"]});
// no leading slash, treated as pattern, slash doesn't need to be escaped
verify.importFixModuleSpecifiers("", ["ambient"], { autoImportSpecifierExcludeRegexes: ["^ambient/"] });
verify.importFixModuleSpecifiers("", ["ambient/utils"], { autoImportSpecifierExcludeRegexes: ["ambient$"] });
verify.importFixModuleSpecifiers("", ["ambient", "ambient/utils"], { autoImportSpecifierExcludeRegexes: ["oops("] });
verify.completions({
marker: "",
includes: [{
name: "x",
source: "ambient",
sourceDisplay: "ambient",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}, {
name: "x",
source: "ambient/utils",
sourceDisplay: "ambient/utils",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}],
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true
}
});
verify.completions({
marker: "",
excludes: ["ambient/utils"],
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
autoImportSpecifierExcludeRegexes: ["utils"]
},
}) | {
"end_byte": 2331,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportSpecifierExcludeRegexes1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCannotFindModule_all.ts_0_717 | /// <reference path='fourslash.ts' />
// @moduleResolution: node
// @noImplicitAny: true
// @Filename: /node_modules/abs/index.js
////not read
// @Filename: /node_modules/zap/index.js
////not read
// @Filename: /a.ts
/////**/import * as abs from "abs";
////import * as zap from "zap";
test.setTypesRegistry({
"abs": undefined,
"zap": undefined,
});
goTo.marker();
verify.codeFixAll({
fixId: "installTypesPackage",
fixAllDescription: "Install all missing types packages",
newFileContent: {}, // no changes
commands: [
{ packageName: "@types/abs", file: "/a.ts", type: "install package" },
{ packageName: "@types/zap", file: "/a.ts", type: "install package" },
],
});
| {
"end_byte": 717,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCannotFindModule_all.ts"
} |
TypeScript/tests/cases/fourslash/extract-const_jsxSelfClosingElement3.ts_0_777 | /// <reference path='fourslash.ts' />
// @jsx: preserve
// @filename: a.tsx
////declare var React: any;
////class Foo extends React.Component<{}, {}> {
//// render() {
//// return (
//// <div>
//// /*a*/<br />/*b*/
//// </div>
//// );
//// }
////}
goTo.file("a.tsx");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_1",
actionDescription: "Extract to readonly field in class 'Foo'",
newContent:
`declare var React: any;
class Foo extends React.Component<{}, {}> {
private readonly newProperty = <br />;
render() {
return (
<div>
{this./*RENAME*/newProperty}
</div>
);
}
}`
});
| {
"end_byte": 777,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxSelfClosingElement3.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_callComments2.ts_0_843 | /// <reference path='fourslash.ts' />
////function /*a*/foo/*b*/(a: number, b: number, ...rest: number[]) {
//// return a + b;
////}
////foo(
//// /**a*/
//// 1,
//// /**c*/
//// 2,
//// /**e*/
//// 3,
//// /**g*/
//// 4);
goTo.select("a", "b");
/* The expected content is currently wrong. The new argument object has the wrong formatting. */
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `function foo({ a, b, rest = [] }: { a: number; b: number; rest?: number[]; }) {
return a + b;
}
foo(
{ /**a*/
a: 1, /**c*/
b: 2, rest: [
/**e*/
3,
/**g*/
4]
});`
}); | {
"end_byte": 843,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_callComments2.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_typeUsedAsValue.ts_0_278 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export class ReadonlyArray<T> {}
// @Filename: /b.ts
////[|new ReadonlyArray<string>();|]
goTo.file("/b.ts");
verify.importFixAtPosition([
`import { ReadonlyArray } from "./a";
new ReadonlyArray<string>();`,
]);
| {
"end_byte": 278,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_typeUsedAsValue.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts_0_655 | /// <reference path='fourslash.ts'/>
// Should return method implementations in object literals within variable-like declarations
//// interface Foo {
//// he/*declaration*/llo: () => void
//// }
////
//// var bar: Foo = { [|hello|]: helloImpl };
//// var baz: Foo = { "[|hello|]": helloImpl };
////
//// function helloImpl () {}
////
//// function whatever(x: Foo = { [|hello|]() {/**1*/} }) {
//// x.he/*function_call*/llo()
//// }
////
//// class Bar {
//// x: Foo = { [|hello|]() {/*2*/} }
////
//// constructor(public f: Foo = { [|hello|]() {/**3*/} } ) {}
//// }
verify.baselineGoToImplementation("function_call", "declaration");
| {
"end_byte": 655,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts_0_223 | /// <reference path='fourslash.ts'/>
// @Filename: b.ts
////import n = require([|'./a/*1*/'|]);
////var x = new n.Foo();
// @Filename: a.ts
/////*2*/class Foo {}
////export var x = 0;
verify.baselineGoToDefinition("1");
| {
"end_byte": 223,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionExternalModuleName2.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateConstructor01.ts_0_631 | /// <reference path='fourslash.ts' />
////class C {
//// private p;
//// /*0*/
//// constructor(a, b, c, d);
//// /*1*/
//// constructor(public a, private b, protected c, d, e?) {
//// }
////
//// foo();
//// foo(a?, b?, ...args) {
//// }
////}
const newTextOffset = 11;
verify.docCommentTemplateAt("0", /*newTextOffset*/ newTextOffset,
`/**
*
* @param a
* @param b
* @param c
* @param d
*/`);
verify.docCommentTemplateAt("1", /*newTextOffset*/ newTextOffset,
`/**
*
* @param a
* @param b
* @param c
* @param d
* @param e
*/`);
| {
"end_byte": 631,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateConstructor01.ts"
} |
TypeScript/tests/cases/fourslash/completionListStringParenthesizedType.ts_0_2070 | /// <reference path='fourslash.ts'/>
////type T1 = "a" | "b" | "c";
////type T2<T extends T1> = {};
////
////type T3 = T2<"[|/*1*/|]">;
////type T4 = T2<("[|/*2*/|]")>;
////type T5 = T2<(("[|/*3*/|]"))>;
////type T6 = T2<((("[|/*4*/|]")))>;
////
////type T7<P extends T1, K extends T1> = {};
////type T8 = T7<"a", ((("[|/*5*/|]")))>;
////
////interface Foo {
//// a: number;
//// b: number;
////}
////const a: Foo["[|/*6*/|]"];
////const b: Foo[("[|/*7*/|]")];
////const b: Foo[(("[|/*8*/|]"))];
const [r1, r2, r3, r4, r5, r6, r7, r8] = test.ranges();
verify.completions(
{
marker: "1",
exact: [
{ name: "a", replacementSpan: r1 },
{ name: "b", replacementSpan: r1 },
{ name: "c", replacementSpan: r1 }
]
},
{
marker: "2",
exact: [
{ name: "a", replacementSpan: r2 },
{ name: "b", replacementSpan: r2 },
{ name: "c", replacementSpan: r2 }
]
},
{
marker: "3",
exact: [
{ name: "a", replacementSpan: r3 },
{ name: "b", replacementSpan: r3 },
{ name: "c", replacementSpan: r3 }
]
},
{
marker: "4",
exact: [
{ name: "a", replacementSpan: r4 },
{ name: "b", replacementSpan: r4 },
{ name: "c", replacementSpan: r4 }
]
},
{
marker: "5",
exact: [
{ name: "a", replacementSpan: r5 },
{ name: "b", replacementSpan: r5 },
{ name: "c", replacementSpan: r5 }
]
},
{
marker: "6",
exact: [
{ name: "a", replacementSpan: r6 },
{ name: "b", replacementSpan: r6 }
]
},
{
marker: "7",
exact: [
{ name: "a", replacementSpan: r7 },
{ name: "b", replacementSpan: r7 }
]
},
{
marker: "8",
exact: [
{ name: "a", replacementSpan: r8 },
{ name: "b", replacementSpan: r8 }
]
}
);
| {
"end_byte": 2070,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListStringParenthesizedType.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprWithPropertyAccess.ts_0_431 | /// <reference path='fourslash.ts' />
////const a = { prop: 1 };
////const b = /*x*/a.prop/*y*/ + "a" + "b";
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 a = { prop: 1 };",
"const b = `${a.prop}ab`;"
].join("\n")
});
| {
"end_byte": 431,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprWithPropertyAccess.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess9.ts_0_546 | /// <reference path='fourslash.ts' />
//// class A {
//// @foo
//// /*a*/public a: string = "foo";/*b*/
//// }
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 {
@foo
private /*RENAME*/_a: string = "foo";
public get a(): string {
return this._a;
}
public set a(value: string) {
this._a = value;
}
}`,
});
| {
"end_byte": 546,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess9.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_prologueDirectives5.ts_0_465 | /// <reference path='fourslash.ts' />
// @module: esnext
// @Filename: /foo.ts
////export default function () {}
// @Filename: /a.ts
////"use strict";
////import foo from "./foo";
////[|function b() {
//// return foo;
////}|]
////b();
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`"use strict";
import { b } from "./b";
b();`,
"/b.ts":
`"use strict";
import foo from "./foo";
export function b() {
return foo;
}
`,
},
});
| {
"end_byte": 465,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_prologueDirectives5.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete4.ts_0_417 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f ` ${ } ${/*1*/ /*2*/
verify.signatureHelp({
marker: test.markers(),
text: "f(templateStrings: any, x: any, y: any, z: any): number",
argumentCount: 3,
parameterCount: 4,
parameterName: "y",
parameterSpan: "y: any",
});
| {
"end_byte": 417,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingAwait_initializer4.ts_0_406 | /// <reference path="fourslash.ts" />
////async function fn(a: string, b: Promise<string>) {
//// const x = b;
//// const y = b;
//// x + y;
////}
verify.codeFix({
description: "Add 'await' to initializers",
index: 0,
newFileContent:
`async function fn(a: string, b: Promise<string>) {
const x = await b;
const y = await b;
x + y;
}`
});
verify.not.codeFixAllAvailable("addMissingAwait");
| {
"end_byte": 406,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAwait_initializer4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction11.ts_0_351 | /// <reference path='fourslash.ts' />
////const f: string = () => {
//// await Promise.resolve('foo');
////}
// should not change type if it's incorrectly set
verify.codeFix({
index: 0,
description: "Add async modifier to containing function",
newFileContent:
`const f: string = async () => {
await Promise.resolve('foo');
}`
});
| {
"end_byte": 351,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction11.ts"
} |
TypeScript/tests/cases/fourslash/jsDocSee3.ts_0_256 | ///<reference path="fourslash.ts" />
//// function foo ([|/*def1*/a|]: string) {
//// /**
//// * @see {/*use1*/[|a|]}
//// */
//// function bar ([|/*def2*/a|]: string) {
//// }
//// }
verify.baselineGetDefinitionAtPosition("use1");
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocSee3.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectBindingPattern15.ts_0_712 | /// <reference path="fourslash.ts"/>
////class Foo {
//// private xxx1 = 1;
//// protected xxx2 = 2;
//// public xxx3 = 3;
//// private static xxx4 = 4;
//// protected static xxx5 = 5;
//// public static xxx6 = 6;
//// foo() {
//// const { /*1*/ } = this;
//// const { /*2*/ } = Foo;
//// }
////}
////
////const { /*3*/ } = new Foo();
////const { /*4*/ } = Foo;
verify.completions({ marker: "1", unsorted: ["xxx1", "xxx2", "xxx3", "foo"] });
verify.completions({ marker: "2", unsorted: ["prototype", "xxx4", "xxx5", "xxx6"] });
verify.completions({ marker: "3", unsorted: ["xxx3", "foo"] });
verify.completions({ marker: "4", unsorted: ["prototype", "xxx6"] });
| {
"end_byte": 712,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectBindingPattern15.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalNoNullish.ts_0_388 | /// <reference path='fourslash.ts' />
// @strict: true
////interface Foo {
//// bar?:{
//// baz?: string | null;
//// }
////}
////declare let foo: Foo;
/////*a*/foo.bar ? foo.bar.baz : "whenFalse";/*b*/
// do not offer a refactor for ternary expression if type of baz is nullish
goTo.select("a", "b");
verify.not.refactorAvailable("Convert to optional chain expression");
| {
"end_byte": 388,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_ConditionalNoNullish.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsReExportStar.ts_0_265 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export function /*0*/foo(): void {}
// @Filename: /b.ts
////export * from "./a";
// @Filename: /c.ts
////import { /*1*/foo } from "./b";
verify.noErrors();
verify.baselineFindAllReferences('0', '1')
| {
"end_byte": 265,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsReExportStar.ts"
} |
TypeScript/tests/cases/fourslash/commentsModulesFourslash.ts_0_6308 | /// <reference path='fourslash.ts' />
/////** Namespace comment*/
////namespace m/*1*/1 {
//// /** b's comment*/
//// export var b: number;
//// /** foo's comment*/
//// function foo() {
//// return /*2*/b;
//// }
//// /** m2 comments*/
//// export namespace m2 {
//// /** class comment;*/
//// export class c {
//// };
//// /** i*/
//// export var i = new c();
//// }
//// /** exported function*/
//// export function fooExport() {
//// return fo/*3q*/o(/*3*/);
//// }
////}
/////*4*/m1./*5*/fooExport(/*6*/);
////var my/*7*/var = new m1.m2./*8*/c();
/////** namespace comment of m2.m3*/
////namespace m2.m3 {
//// /** Exported class comment*/
//// export class c {
//// }
////}
////new /*9*/m2./*10*/m3./*11*/c();
/////** namespace comment of m3.m4.m5*/
////namespace m3.m4.m5 {
//// /** Exported class comment*/
//// export class c {
//// }
////}
////new /*12*/m3./*13*/m4./*14*/m5./*15*/c();
/////** namespace comment of m4.m5.m6*/
////namespace m4.m5.m6 {
//// export namespace m7 {
//// /** Exported class comment*/
//// export class c {
//// }
//// }
////}
////new /*16*/m4./*17*/m5./*18*/m6./*19*/m7./*20*/c();
/////** namespace comment of m5.m6.m7*/
////namespace m5.m6.m7 {
//// /** namespace m8 comment*/
//// export namespace m8 {
//// /** Exported class comment*/
//// export class c {
//// }
//// }
////}
////new /*21*/m5./*22*/m6./*23*/m7./*24*/m8./*25*/c();
////namespace m6.m7 {
//// export namespace m8 {
//// /** Exported class comment*/
//// export class c {
//// }
//// }
////}
////new /*26*/m6./*27*/m7./*28*/m8./*29*/c();
////namespace m7.m8 {
//// /** namespace m9 comment*/
//// export namespace m9 {
//// /** Exported class comment*/
//// export class c {
//// }
//// }
////}
////new /*30*/m7./*31*/m8./*32*/m9./*33*/c();
////declare module "quotedM" {
//// export class c {
//// }
//// export var b: /*34*/c;
////}
////namespace complexM {
//// export namespace m1 {
//// export class c {
//// public foo() {
//// return 30;
//// }
//// }
//// }
//// export namespace m2 {
//// export class c {
//// public foo2() {
//// return new complexM.m1.c();
//// }
//// }
//// }
////}
////var myComp/*35*/lexVal = new compl/*36*/exM.m/*37*/2./*38*/c().f/*39*/oo2().f/*40*/oo();
verify.quickInfoAt("1", "namespace m1", "Namespace comment");
verify.completions({
marker: "2",
includes: [
{ name: "b", text: "var b: number", documentation: "b's comment" },
{ name: "foo", text: "function foo(): number", documentation: "foo's comment" },
],
});
verify.signatureHelp({ marker: "3", docComment: "foo's comment" });
verify.quickInfoAt("3q", "function foo(): number", "foo's comment");
verify.completions(
{ marker: "4", includes: { name: "m1", text: "namespace m1", documentation: "Namespace comment" } },
{
marker: "5",
includes: [
{ name: "b", text: "var m1.b: number", documentation: "b's comment" },
{ name: "fooExport", text: "function m1.fooExport(): number", documentation: "exported function" },
{ name: "m2", text: "namespace m1.m2", documentation: "m2 comments" },
],
},
);
verify.quickInfoAt("5", "function m1.fooExport(): number", "exported function");
verify.signatureHelp({ marker: "6", docComment: "exported function" });
verify.quickInfoAt("7", "var myvar: m1.m2.c");
verify.quickInfoAt("8", "constructor m1.m2.c(): m1.m2.c", "class comment;");
verify.completions(
{
marker: "8",
includes: [
{ name: "c", text: "constructor m1.m2.c(): m1.m2.c", documentation: "class comment;" },
{ name: "i", text: "var m1.m2.i: m1.m2.c", documentation: "i" },
],
}
);
function both(marker: string, name: string, text: string, documentation?: string) {
verify.completions({ marker, includes: { name, text, documentation } });
verify.quickInfoAt(marker, text, documentation);
}
both("9", "m2", "namespace m2", "namespace comment of m2.m3");
both("10", "m3", "namespace m2.m3", "namespace comment of m2.m3");
both("11", "c", "constructor m2.m3.c(): m2.m3.c", "Exported class comment");
both("12", "m3", "namespace m3", "namespace comment of m3.m4.m5");
both("13", "m4", "namespace m3.m4", "namespace comment of m3.m4.m5");
both("14", "m5", "namespace m3.m4.m5", "namespace comment of m3.m4.m5");
both("15", "c", "constructor m3.m4.m5.c(): m3.m4.m5.c", "Exported class comment");
both("16", "m4", "namespace m4", "namespace comment of m4.m5.m6");
both("17", "m5", "namespace m4.m5", "namespace comment of m4.m5.m6");
both("18", "m6", "namespace m4.m5.m6", "namespace comment of m4.m5.m6");
both("19", "m7", "namespace m4.m5.m6.m7");
verify.completions({
marker: "20",
includes: { name: "c", text: "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", documentation: "Exported class comment" },
});
verify.quickInfoAt("20", "constructor m4.m5.m6.m7.c(): m4.m5.m6.m7.c", "Exported class comment");
both("21", "m5", "namespace m5", "namespace comment of m5.m6.m7");
both("22", "m6", "namespace m5.m6", "namespace comment of m5.m6.m7");
both("23", "m7", "namespace m5.m6.m7", "namespace comment of m5.m6.m7");
both("24", "m8", "namespace m5.m6.m7.m8", "namespace m8 comment");
both("25", "c", "constructor m5.m6.m7.m8.c(): m5.m6.m7.m8.c", "Exported class comment");
both("26", "m6", "namespace m6");
both("27", "m7", "namespace m6.m7");
both("28", "m8", "namespace m6.m7.m8");
both("29", "c", "constructor m6.m7.m8.c(): m6.m7.m8.c", "Exported class comment");
both("30", "m7", "namespace m7");
both("31", "m8", "namespace m7.m8");
both("32", "m9", "namespace m7.m8.m9", "namespace m9 comment");
both("33", "c", "constructor m7.m8.m9.c(): m7.m8.m9.c", "Exported class comment");
both("34", "c", "class c");
verify.quickInfos({
35: "var myComplexVal: number",
36: "namespace complexM",
37: "namespace complexM.m2",
38: "constructor complexM.m2.c(): complexM.m2.c",
39: "(method) complexM.m2.c.foo2(): complexM.m1.c",
40: "(method) complexM.m1.c.foo(): number",
});
| {
"end_byte": 6308,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/commentsModulesFourslash.ts"
} |
TypeScript/tests/cases/fourslash/jsdocLink4.ts_0_390 | ///<reference path="fourslash.ts" />
//// declare class I {
//// /** {@link I} */
//// bar/*1*/(): void
//// }
//// /** {@link I} */
//// var n/*2*/ = 1
//// /**
//// * A real, very serious {@link I to an interface}. Right there.
//// * @param x one {@link Pos here too}
//// */
//// function f(x) {
//// }
//// f/*3*/()
//// type Pos = [number, number]
verify.baselineQuickInfo();
| {
"end_byte": 390,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocLink4.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingAsync.ts_0_483 | /// <reference path="fourslash.ts" />
////interface Stuff {
//// b: () => Promise<string>;
////}
////
////function foo(): Stuff | Date {
//// return {
//// b: () => "hello",
//// }
////}
verify.codeFix({
description: ts.Diagnostics.Add_async_modifier_to_containing_function.message,
index: 0,
newFileContent:
`interface Stuff {
b: () => Promise<string>;
}
function foo(): Stuff | Date {
return {
b: async () => "hello",
}
}`
});
| {
"end_byte": 483,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingAsync.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties11.ts_0_397 | /// <reference path='fourslash.ts' />
////interface Foo {
//// a: `--${string}`;
//// b: string;
//// c: "a" | "b"
////}
////[|const foo: Foo = {}|];
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
preferences: {
quotePreference: "single"
},
newRangeContent:
`const foo: Foo = {
a: '',
b: '',
c: 'a'
}`
});
| {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties11.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForModuleGlobal.ts_0_281 | /// <reference path="fourslash.ts" />
// @Filename: /node_modules/foo/index.d.ts
////export const x = 0;
// @Filename: /b.ts
/////// <reference types="foo" />
////import { x } from "/*1*/foo";
////declare module "foo" {}
verify.noErrors();
verify.baselineFindAllReferences('1')
| {
"end_byte": 281,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForModuleGlobal.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName05.ts_0_247 | /// <reference path='fourslash.ts'/>
////interface I {
//// property1: number;
//// property2: string;
////}
////
////function f({ /**/property1: p }, { property1 }) {
//// let x = property1;
////}
verify.baselineFindAllReferences("");
| {
"end_byte": 247,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName05.ts"
} |
TypeScript/tests/cases/fourslash/completionListOfGenericSymbol.ts_0_770 | /// <reference path="fourslash.ts" />
// Ensure kind is set correctly on completions of a generic symbol
////var a = [1,2,3];
////a./**/
verify.completions({
marker: "",
includes: [
{
name: "length",
text: "(property) Array<number>.length: number",
documentation: "Gets or sets the length of the array. This is a number one higher than the highest index in the array.",
kind: "property",
kindModifiers: "declare",
},
{
name: "toString",
text: "(method) Array<number>.toString(): string",
documentation: "Returns a string representation of an array.",
kind: "method",
kindModifiers: "declare",
},
],
});
| {
"end_byte": 770,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOfGenericSymbol.ts"
} |
TypeScript/tests/cases/fourslash/superInsideInnerClass.ts_0_254 | /// <reference path="fourslash.ts" />
////class Base {
//// constructor(n: number) {
//// }
////}
////class Derived extends Base {
//// constructor() {
//// class Nested {
//// [super(/*1*/)] = 11111
//// }
//// }
////}
verify.noSignatureHelp("1");
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/superInsideInnerClass.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralExpressions5.ts_0_923 | /// <reference path="fourslash.ts" />
//// type E = {}
//// type F = string
//// interface I { e: E, f?: F }
//// const i: I = { e: {}
//// /**/
//// };
verify.completions({
marker: "",
includes: [{
name: "f",
sortText: completion.SortText.OptionalMember,
hasAction: true,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
}],
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
verify.applyCodeActionFromCompletion("", {
name: "f",
description: `Add missing comma for object member completion 'f'.`,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
newFileContent:
`type E = {}
type F = string
interface I { e: E, f?: F }
const i: I = { e: {},
};`,
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 923,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralExpressions5.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstToCommaSeparatedInitializer3.ts_0_310 | /// <reference path='fourslash.ts' />
////function f() { return 42; }
////x = 0, y = f()
////
////, z = 0;
verify.codeFixAll({
fixId: "addMissingConst",
fixAllDescription: "Add 'const' to all unresolved variables",
newFileContent: `function f() { return 42; }
const x = 0, y = f()
, z = 0;`
});
| {
"end_byte": 310,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstToCommaSeparatedInitializer3.ts"
} |
TypeScript/tests/cases/fourslash/organizeImportsType1.ts_0_986 | /// <reference path='fourslash.ts' />
// @allowSyntheticDefaultImports: true
// @moduleResolution: node
// @noUnusedLocals: true
// @target: es2018
//// import { A } from "foo";
//// import { type B } from "foo";
//// import { C } from "foo";
//// import { type E } from "foo";
//// import { D } from "foo";
////
//// console.log(A, B, C, D, E);
// default behavior is "last"
verify.organizeImports(
`import { A, C, D, type B, type E } from "foo";
console.log(A, B, C, D, E);`
);
verify.organizeImports(
`import { A, type B, C, D, type E } from "foo";
console.log(A, B, C, D, E);`,
undefined,
{ organizeImportsTypeOrder : "inline" }
);
verify.organizeImports(
`import { type B, type E, A, C, D } from "foo";
console.log(A, B, C, D, E);`,
undefined,
{ organizeImportsTypeOrder : "first" }
);
verify.organizeImports(
`import { A, C, D, type B, type E } from "foo";
console.log(A, B, C, D, E);`,
undefined,
{ organizeImportsTypeOrder : "last" }
); | {
"end_byte": 986,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsType1.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionConstructorOfClassExpression01.ts_0_640 | /// <reference path='fourslash.ts' />
////var x = class C {
//// /*definition*/constructor() {
//// var other = new [|/*xusage*/C|];
//// }
////}
////
////var y = class C extends x {
//// constructor() {
//// super();
//// var other = new [|/*yusage*/C|];
//// }
////}
////var z = class C extends x {
//// m() {
//// return new [|/*zusage*/C|];
//// }
////}
////
////var x1 = new [|/*cref*/C|]();
////var x2 = new [|/*xref*/x|]();
////var y1 = new [|/*yref*/y|]();
////var z1 = new [|/*zref*/z|]();
verify.baselineGoToDefinition("xusage", "yusage", "zusage", "cref", "xref", "yref", "zref");
| {
"end_byte": 640,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionConstructorOfClassExpression01.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_promoteTypeOnly1.ts_0_929 | /// <reference path="fourslash.ts" />
// @module: es2015
// @Filename: /exports.ts
//// export interface SomeInterface {}
//// export class SomePig {}
// @Filename: /a.ts
//// import type { SomeInterface, SomePig } from "./exports.js";
//// new SomePig/**/
verify.completions({
marker: "",
exact: completion.globalsPlus([{
name: "SomePig",
source: completion.CompletionSource.TypeOnlyAlias,
hasAction: true,
}]),
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "SomePig",
source: completion.CompletionSource.TypeOnlyAlias,
description: `Remove 'type' from import declaration from "./exports.js"`,
newFileContent:
`import { SomeInterface, SomePig } from "./exports.js";
new SomePig`,
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 929,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_promoteTypeOnly1.ts"
} |
TypeScript/tests/cases/fourslash/unusedTypeParametersInLambda1.ts_0_276 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
//// function f1() {
//// [|return <T>(x:number) => {x}|]
//// }
verify.codeFix({
description: "Remove type parameters",
newRangeContent: "return (x:number) => {x}",
});
| {
"end_byte": 276,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedTypeParametersInLambda1.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForMappedType.ts_0_252 | /// <reference path='fourslash.ts'/>
////interface T { /*1*/a: number };
////type U = { [K in keyof T]: string };
////type V = { [K in keyof U]: boolean };
////const u: U = { a: "" }
////const v: V = { a: true }
verify.baselineFindAllReferences('1')
| {
"end_byte": 252,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForMappedType.ts"
} |
TypeScript/tests/cases/fourslash/cloduleTypeOf1.ts_0_806 | /// <reference path='fourslash.ts'/>
////class C<T> {
//// static foo(x: number) { }
//// x: T;
////}
////
////module C {
//// export function f(x: typeof C) {
//// x./*1*/
//// var /*3*/r = new /*2*/x<number>();
//// var /*5*/r2 = r./*4*/
//// return typeof r;
//// }
////}
verify.completions({
marker: "1",
includes: [
{ name: "f", sortText: completion.SortText.LocationPriority },
{ name: "foo", sortText: completion.SortText.LocalDeclarationPriority }
]
});
edit.insert('foo(1);');
verify.completions({ marker: "2", includes: "x" });
verify.quickInfoAt("3", "(local var) r: C<number>");
verify.completions({ marker: "4", includes: "x" });
edit.insert('x;');
verify.quickInfoAt("5", "(local var) r2: number");
verify.noErrors(); | {
"end_byte": 806,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/cloduleTypeOf1.ts"
} |
TypeScript/tests/cases/fourslash/numericPropertyNames.ts_0_145 | /// <reference path='fourslash.ts'/>
////var /**/t2 = { 0: 1, 1: "" };
verify.quickInfoAt("", "var t2: {\n 0: number;\n 1: string;\n}");
| {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/numericPropertyNames.ts"
} |
TypeScript/tests/cases/fourslash/documentHighlights_filesToSearch.ts_0_179 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export const [|x|] = 0;
// @Filename: /b.ts
////import { [|x|] } from "./a";
verify.baselineDocumentHighlights();
| {
"end_byte": 179,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/documentHighlights_filesToSearch.ts"
} |
TypeScript/tests/cases/fourslash/codeFixWrapJsxInFragment.ts_0_206 | /// <reference path='fourslash.ts' />
// @jsx: react
// @Filename: /a.tsx
////[|<a /><a />|]
verify.rangeAfterCodeFix(`<><a /><a /></>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
| {
"end_byte": 206,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixWrapJsxInFragment.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration20.ts_0_170 | /// <reference path="fourslash.ts" />
////const a = {
//// b: { f(x: number) {} }
////}
////a.b.f(foo);
verify.not.codeFixAvailable("fixMissingFunctionDeclaration");
| {
"end_byte": 170,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration20.ts"
} |
TypeScript/tests/cases/fourslash/formattingRegexes.ts_0_261 | ///<reference path="fourslash.ts"/>
////removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true)/*1*/
goTo.marker("1");
edit.insert(";");
verify.currentLineContentIs("removeAllButLast(sortedTypes, undefinedType, /keepNullableType**/ true);");
| {
"end_byte": 261,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingRegexes.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationSuper_00.ts_0_335 | /// <reference path='fourslash.ts'/>
// Should go to super class declaration when invoked on a super call expression
//// class [|Foo|] {
//// constructor() {}
//// }
////
//// class Bar extends Foo {
//// constructor() {
//// su/*super_call*/per();
//// }
//// }
verify.baselineGoToImplementation("super_call"); | {
"end_byte": 335,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationSuper_00.ts"
} |
TypeScript/tests/cases/fourslash/mapCodeNoRanges.ts_0_236 | ///<reference path="fourslash.ts"/>
// @Filename: /index.ts
//// function foo() {
//// return 1;
//// }
//// function bar() {
//// return 2;
//// }
////
verify.baselineMapCode([[]], [
`
function baz() {
return 3;
}
`
]);
| {
"end_byte": 236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodeNoRanges.ts"
} |
TypeScript/tests/cases/fourslash/formatTemplateLiteral.ts_0_1123 | /// <reference path="fourslash.ts"/>
////var x = `sadasdasdasdasfegsfd
/////*1*/rasdesgeryt35t35y35 e4 ergt er 35t 3535 `;
////var y = `1${2}/*2*/3`;
////
/////*formatStart*/
////let z= `foo`;/*3*/
////let w= `bar${3}`;/*4*/
////String.raw
//// `template`;/*5*/
////String.raw`foo`;/*6*/
////String.raw `bar${3}`;/*7*/
////`Write ${ JSON.stringify("") } and ${ (765) } and ${ 346 }`;/*spaceInside*/
/////*formatEnd*/
goTo.marker("1");
edit.insert("\n"); // edit will trigger formatting - should succeeed
goTo.marker("2");
edit.insert("\n");
verify.indentationIs(0);
verify.currentLineContentIs("3`;")
format.selection("formatStart", "formatEnd");
goTo.marker("3");
verify.currentLineContentIs("let z = `foo`;");
goTo.marker("4");
verify.currentLineContentIs("let w = `bar${3}`;");
goTo.marker("5");
verify.currentLineContentIs(" `template`;");
goTo.marker("6");
verify.currentLineContentIs("String.raw`foo`;");
goTo.marker("7");
verify.currentLineContentIs("String.raw`bar${3}`;");
goTo.marker("spaceInside");
verify.currentLineContentIs('`Write ${JSON.stringify("")} and ${(765)} and ${346}`;'); | {
"end_byte": 1123,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatTemplateLiteral.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports21-params-and-return.ts_0_807 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @lib: es2019
/////**
//// * Test
//// */
////export function foo(): number { return 0; }
/////**
////* Docs
////*/
////export const bar = (a = foo()) =>
//// a;
////// Trivia
verify.codeFix({
description: "Add return type 'number'",
index: 0,
applyChanges: true,
newFileContent:
`/**
* Test
*/
export function foo(): number { return 0; }
/**
* Docs
*/
export const bar = (a = foo()): number =>
a;
// Trivia`
});
verify.codeFix({
description: "Add annotation of type 'number'",
index: 0,
applyChanges: true,
newFileContent:
`/**
* Test
*/
export function foo(): number { return 0; }
/**
* Docs
*/
export const bar = (a: number = foo()): number =>
a;
// Trivia`
});
| {
"end_byte": 807,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports21-params-and-return.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInFunctionTypeReference.ts_0_292 | /// <reference path='fourslash.ts' />
////function map(fn: (variab/*1*/le1: string) => void) {
////}
////var x = <{ (fn: (va/*2*/riable2: string) => void, a: string): void; }> () => { };
verify.quickInfos({
1: "(parameter) variable1: string",
2: "(parameter) variable2: string"
});
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInFunctionTypeReference.ts"
} |
TypeScript/tests/cases/fourslash/codeFixWrapJsxInFragmentWithGrammarError1.ts_0_313 | /// <reference path='fourslash.ts' />
// @jsx: react-jsxdev
// @Filename: /a.tsx
////[|<div abc={{ foo = 10 }}></div><div abc={{ foo = 10 }}></div>|]
verify.rangeAfterCodeFix(`<><div abc={{ foo = 10 }}></div><div abc={{ foo = 10 }}></div></>`, /*includeWhiteSpace*/false, /*errorCode*/ undefined, /*index*/ 0);
| {
"end_byte": 313,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixWrapJsxInFragmentWithGrammarError1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_For.ts_0_418 | /// <reference path='fourslash.ts' />
//// const foo = /*x*/f/*y*/unction() {
//// for (let i = 0; i < 5; i++) { }
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to arrow function",
actionDescription: "Convert to arrow function",
newContent: `const foo = () => {
for (let i = 0; i < 5; i++) { }
};`,
});
| {
"end_byte": 418,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_For.ts"
} |
TypeScript/tests/cases/fourslash/selfReferencedExternalModule.ts_0_301 | /// <reference path='fourslash.ts' />
// @Filename: app.ts
////export import A = require('./app');
////export var I = 1;
////A./**/I
verify.completions({
marker: "",
exact: [
{ name: "A", text: "import A = require('./app')" },
{ name: "I", text: "var I: number" },
],
});
| {
"end_byte": 301,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/selfReferencedExternalModule.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesConst03.ts_0_345 | /// <reference path='fourslash.ts' />
////module m {
//// export /*1*/const x;
//// export [|const|] enum E {
//// }
////}
////
////export /*2*/const x;
////export [|const|] enum E {
////}
verify.baselineDocumentHighlights(); // They are in different scopes, so not counted together.
verify.baselineDocumentHighlights(test.markers()); | {
"end_byte": 345,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesConst03.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction4.ts_0_358 | /// <reference path='fourslash.ts' />
//// const foo = /*a*/a/*b*/ => { return a + 1; };
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 => a + 1;`,
});
| {
"end_byte": 358,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction4.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts_0_713 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export 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: `Change 'foo' to 'a.foo'`,
newFileContent: `import * as a from "./a";
a.f;`,
});
| {
"end_byte": 713,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_named_namespaceImportExists.ts"
} |
TypeScript/tests/cases/fourslash/tsxRename2.ts_0_468 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// div: {
//// [|[|{| "contextRangeIndex": 0 |}name|]?: string;|]
//// isOpen?: boolean;
//// };
//// span: { n: string; };
//// }
//// }
//// var x = <div [|[|{| "contextRangeIndex": 2 |}name|]="hello"|] />;
verify.baselineRenameAtRangesWithText("name");
| {
"end_byte": 468,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxRename2.ts"
} |
TypeScript/tests/cases/fourslash/renameReferenceFromLinkTag1.ts_0_128 | /// <reference path="fourslash.ts" />
////enum E {
//// /** {@link /**/A} */
//// A
////}
verify.baselineRename("", {}); | {
"end_byte": 128,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameReferenceFromLinkTag1.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPattern.ts_0_3569 | /// <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;
////}
////let nameA: string, primarySkillA: string, secondarySkillA: string;
////let numberB: number, nameB: string;
////let numberA2: number, nameA2: string, skillA2: string, nameMA: string;
////let numberA3: number, robotAInfo: (number | string)[], multiRobotAInfo: (string | [string, string])[];
////let i: number;
////for ([, nameA] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for ([, nameA] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for ([, nameA] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for ([, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for ([, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for ([, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for ([numberB] = robotA, i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for ([numberB] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for ([numberB] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for ([nameB] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for ([nameB] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for ([nameB] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for ([numberA2, nameA2, skillA2] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for ([numberA2, nameA2, skillA2] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for ([numberA2, nameA2, skillA2] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for ([nameMA, [primarySkillA, secondarySkillA]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for ([numberA3, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for ([numberA3, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for ([numberA3, ...robotAInfo] = <Robot>[2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for ([...multiRobotAInfo] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
////for ([...multiRobotAInfo] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
////for ([...multiRobotAInfo] = <MultiSkilledRobot>["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(multiRobotAInfo);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 3569,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringAssignmentForArrayBindingPattern.ts"
} |
TypeScript/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts_0_277 | /// <reference path='fourslash.ts'/>
////module ObjectLiterals {
//// interface MyPoint {
//// x1: number;
//// y1: number;
//// }
////
//// var p1: MyPoint = {
//// /* /*1*/ Comment /*2*/ */
//// };
////}
verify.completions({ marker: test.markers(), exact: undefined });
| {
"end_byte": 277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/noCompletionListOnCommentsInsideObjectLiterals.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionJsxNotSet.ts_0_329 | /// <reference path='fourslash.ts' />
// Regresion tests for GH#46854
// @allowJs: true
// @Filename: /foo.jsx
//// const /*def*/Foo = () => (
//// <div>foo</div>
//// );
//// export default Foo;
// @Filename: /bar.jsx
//// import Foo from './foo';
//// const a = <[|/*use*/Foo|] />
verify.baselineGoToDefinition("use"); | {
"end_byte": 329,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionJsxNotSet.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateInsideFunctionDeclaration.ts_0_207 | /// <reference path='fourslash.ts' />
// @Filename: functionDecl.ts
////f/*0*/unction /*1*/foo/*2*/(/*3*/) /*4*/{ /*5*/}
for (const marker of test.markers()) {
verify.noDocCommentTemplateAt(marker);
}
| {
"end_byte": 207,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateInsideFunctionDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateFunctionExpression.ts_0_210 | /// <reference path='fourslash.ts' />
/////*above*/
////const x = /*next*/ function f(p) {}
for (const marker of test.markerNames()) {
verify.docCommentTemplateAt(marker, 7,
`/**
*
* @param p
*/`);
}
| {
"end_byte": 210,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateFunctionExpression.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInheritDoc5.ts_0_314 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: quickInfoInheritDoc5.js
////function A() {}
////
////class B extends A {
//// /**
//// * @inheritdoc
//// */
//// static /**/value() {
//// return undefined;
//// }
////}
verify.baselineQuickInfo();
| {
"end_byte": 314,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInheritDoc5.ts"
} |
TypeScript/tests/cases/fourslash/jsTagAfterCallback2.ts_0_482 | /// <reference path='fourslash.ts' />
// @Filename: foo.js
// @allowJs: true
// @checkJs: true
//// /** @callback Listener @param x @yeturn {ListenerBlock} */
//// /**
//// * The function used
//// * /*1*/ settings
//// */
//// class /*2*/ListenerBlock {
//// }
// Force a syntax tree to be created.
verify.noMatchingBracePositionInCurrentFile(0);
goTo.marker('1');
edit.insert('fenster');
verify.quickInfoAt('2', 'class ListenerBlock', 'The function used\nfenster settings')
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsTagAfterCallback2.ts"
} |
TypeScript/tests/cases/fourslash/organizeImportsPathsUnicode3.ts_0_726 | /// <reference path="fourslash.ts" />
//// import * as B from "./B";
//// import * as À from "./À";
//// import * as A from "./A";
////
//// console.log(A, À, B);
verify.organizeImports(
`import * as À from "./À";
import * as A from "./A";
import * as B from "./B";
console.log(A, À, B);`, /*mode*/ undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "unicode",
organizeImportsAccentCollation: false,
});
verify.organizeImports(
`import * as A from "./A";
import * as À from "./À";
import * as B from "./B";
console.log(A, À, B);`, /*mode*/ undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "unicode",
organizeImportsAccentCollation: true,
});
| {
"end_byte": 726,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsPathsUnicode3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties25.ts_0_413 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @filename: /a.js
/////**
//// * @type {{ f: (x: string) => number }}
//// */
////[|export const foo = {}|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`export const foo = {
f: function(x) {
throw new Error("Function not implemented.");
}
}`,
});
| {
"end_byte": 413,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties25.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsImportType.ts_0_246 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: /a.js
////module.exports = 0;
/////*1*/export type /*2*/N = number;
// @Filename: /b.js
////type T = import("./a")./*3*/N;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsImportType.ts"
} |
TypeScript/tests/cases/fourslash/completionListForExportEquals.ts_1_419 | ///<reference path="fourslash.ts"/>
// @Filename: /node_modules/foo/index.d.ts
////export = Foo;
////declare var Foo: Foo.Static;
////declare namespace Foo {
//// interface Static {
//// foo(): void;
//// }
////}
// @Filename: /a.ts
////import { /**/ } from "foo";
verify.completions({ marker: "", exact: [
"foo",
"Static",
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }
] });
| {
"end_byte": 419,
"start_byte": 1,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListForExportEquals.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_FnCall.ts_0_399 | /// <reference path='fourslash.ts' />
//// function s(){}
//// const foo = /*x*/f/*y*/unction() {
//// s();
//// };
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 s(){}
const foo = () => {
s();
};`,
});
| {
"end_byte": 399,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_Single_FnCall.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionVariableAssignment2.ts_0_243 | /// <reference path="fourslash.ts" />
// @filename: foo.ts
////const Bar;
////const Foo = /*def*/Bar = function () {}
////Foo.prototype.bar = function() {}
////new [|Foo/*ref*/|]();
goTo.file("foo.ts");
verify.baselineGoToDefinition("ref");
| {
"end_byte": 243,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionVariableAssignment2.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_reExportDefault2.ts_0_1069 | /// <reference path="fourslash.ts" />
// @module: preserve
// @checkJs: true
// @Filename: /node_modules/example/package.json
//// { "name": "example", "version": "1.0.0", "main": "dist/index.js" }
// @Filename: /node_modules/example/dist/nested/module.d.ts
//// declare const defaultExport: () => void;
//// declare const namedExport: () => void;
////
//// export default defaultExport;
//// export { namedExport };
// @Filename: /node_modules/example/dist/index.d.ts
//// export { default, namedExport } from "./nested/module";
// @Filename: /index.mjs
//// import { namedExport } from "example";
//// defaultExp/**/
verify.completions({
marker: "",
exact: completion.globalsInJsPlus([
"namedExport",
{
name: "defaultExport",
source: "example",
sourceDisplay: "example",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
]),
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
},
}); | {
"end_byte": 1069,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_reExportDefault2.ts"
} |
TypeScript/tests/cases/fourslash/autoImportFileExcludePatterns6.ts_0_974 | /// <reference path="fourslash.ts" />
// @Filename: /src/vs/workbench/test.ts
//// import { Parts } from './parts';
//// export class /**/EditorParts implements Parts { }
// @Filename: /src/vs/event/event.ts
//// export interface Event {
//// (): string;
//// }
// @Filename: /src/vs/workbench/parts.ts
//// import { Event } from '../event/event';
//// export interface Parts {
//// readonly options: Event;
//// }
// @Filename: /src/vs/workbench/workbench.ts
//// import { Event } from './canImport';
//// export { Event };
// @Filename: /src/vs/workbench/canImport.ts
//// import { Event } from '../event/event';
//// export { Event };
verify.codeFix({
description: "Implement interface 'Parts'",
newFileContent:
`import { Event } from './canImport';
import { Parts } from './parts';
export class EditorParts implements Parts {
options: Event;
}`,
preferences: {
autoImportFileExcludePatterns: ["src/vs/workbench/workbench.ts"],
}
});
| {
"end_byte": 974,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportFileExcludePatterns6.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion1.ts_0_7220 | ///<reference path="fourslash.ts" />
// @experimentalDecorators: true
// @Filename: a.ts
//// export namespace foo {
//// /** @deprecated */
//// export function faff () { }
//// [|faff|]()
//// }
//// const [|a|] = foo.[|faff|]()
//// foo[[|"faff"|]]
//// const { [|faff|] } = foo
//// [|faff|]()
//// /** @deprecated */
//// export function bar () {
//// foo?.[|faff|]()
//// }
//// foo?.[[|"faff"|]]?.()
//// [|bar|]();
//// /** @deprecated */
//// export interface Foo {
//// /** @deprecated */
//// zzz: number
//// }
//// /** @deprecated */
//// export type QW = [|Foo|][[|"zzz"|]]
//// export type WQ = [|QW|]
//// class C {
//// /** @deprecated */
//// constructor() {
//// }
//// /** @deprecated */
//// m() { }
//// }
//// /** @deprecated */
//// class D {
//// constructor() {
//// }
//// }
//// var c = new [|C|]()
//// c.[|m|]()
//// c.[|m|]
//// new [|D|]()
//// C
//// [|D|]
// @Filename: j.tsx
//// type Props = { someProp?: any }
//// declare var props: Props
//// /** @deprecated */
//// function Compi(_props: Props) {
//// return <div></div>
//// }
//// [|Compi|];
//// <[|Compi|] />;
//// <[|Compi|] {...props}><div></div></[|Compi|]>;
//// /** @deprecated */
//// function ttf(_x: unknown) {
//// }
//// [|ttf|]``
//// [|ttf|]
//// /** @deprecated */
//// function dec(_c: unknown) { }
//// [|dec|]
//// @[|dec|]
//// class K { }
// @Filename: b.ts
//// // imports and aliases
//// import * as f from './a';
//// import { [|bar|], [|QW|] } from './a';
//// f.[|bar|]();
//// f.foo.[|faff|]();
//// [|bar|]();
//// type Z = [|QW|];
//// type A = f.[|Foo|];
//// type B = f.[|QW|];
//// type C = f.WQ;
//// type [|O|] = Z | A | B | C;
goTo.file('a.ts')
const ranges = test.ranges();
verify.getSuggestionDiagnostics([
{
"code": 6387,
"message": "The signature '(): void' of 'faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[0]
},
{
"code": 6133,
"message": "'a' is declared but its value is never read.",
"reportsUnnecessary": true,
"range": ranges[1]
},
{
"code": 6387,
"message": "The signature '(): void' of 'foo.faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[2]
},
{
"code": 6385,
"message": "'faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[3]
},
{
"code": 6385,
"message": "'faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[4]
},
{
"code": 6387,
"message": "The signature '(): void' of 'faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[5]
},
{
"code": 6387,
"message": "The signature '(): void' of 'foo.faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[6]
},
{
"code": 6387,
"message": "The signature '(): void' of 'foo.faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[7]
},
{
"code": 6387,
"message": "The signature '(): void' of 'bar' is deprecated.",
"reportsDeprecated": true,
"range": ranges[8]
},
{
"code": 6385,
"message": "'Foo' is deprecated.",
"reportsDeprecated": true,
"range": ranges[9]
},
{
"code": 6385,
"message": "'zzz' is deprecated.",
"reportsDeprecated": true,
"range": ranges[10]
},
{
"code": 6385,
"message": "'QW' is deprecated.",
"reportsDeprecated": true,
"range": ranges[11]
},
{
"code": 6387,
"message": "The signature '(): C' of 'C' is deprecated.",
"reportsDeprecated": true,
"range": ranges[12]
},
{
"code": 6387,
"message": "The signature '(): void' of 'c.m' is deprecated.",
"reportsDeprecated": true,
"range": ranges[13]
},
{
"code": 6385,
"message": "'m' is deprecated.",
"reportsDeprecated": true,
"range": ranges[14]
},
{
"code": 6385,
"message": "'D' is deprecated.",
"reportsDeprecated": true,
"range": ranges[15]
},
{
"code": 6385,
"message": "'D' is deprecated.",
"reportsDeprecated": true,
"range": ranges[16]
},
]);
goTo.file('j.tsx')
verify.getSuggestionDiagnostics([
{
"code": 6385,
"message": "'Compi' is deprecated.",
"reportsDeprecated": true,
"range": ranges[17]
},
{
"code": 6387,
"message": "The signature '(_props: Props): any' of 'Compi' is deprecated.",
"reportsDeprecated": true,
"range": ranges[18]
},
{
"code": 6387,
"message": "The signature '(_props: Props): any' of 'Compi' is deprecated.",
"reportsDeprecated": true,
"range": ranges[19]
},
{
"code": 6385,
"message": "'Compi' is deprecated.",
"reportsDeprecated": true,
"range": ranges[20]
},
{
"code": 6387,
"message": "The signature '(_x: unknown): void' of 'ttf' is deprecated.",
"reportsDeprecated": true,
"range": ranges[21]
},
{
"code": 6385,
"message": "'ttf' is deprecated.",
"reportsDeprecated": true,
"range": ranges[22]
},
{
"code": 6385,
"message": "'dec' is deprecated.",
"reportsDeprecated": true,
"range": ranges[23]
},
{
"code": 6387,
"message": "The signature '(_c: unknown): void' of 'dec' is deprecated.",
"reportsDeprecated": true,
"range": ranges[24]
},
]);
goTo.file('b.ts')
verify.getSuggestionDiagnostics([
{
"code": 6385,
"message": "'bar' is deprecated.",
"reportsDeprecated": true,
"range": ranges[25]
},
{
"code": 6385,
"message": "'QW' is deprecated.",
"reportsDeprecated": true,
"range": ranges[26]
},
{
"code": 6387,
"message": "The signature '(): void' of 'f.bar' is deprecated.",
"reportsDeprecated": true,
"range": ranges[27]
},
{
"code": 6387,
"message": "The signature '(): void' of 'f.foo.faff' is deprecated.",
"reportsDeprecated": true,
"range": ranges[28]
},
{
"code": 6387,
"message": "The signature '(): void' of 'bar' is deprecated.",
"reportsDeprecated": true,
"range": ranges[29]
},
{
"code": 6385,
"message": "'QW' is deprecated.",
"reportsDeprecated": true,
"range": ranges[30]
},
{
"code": 6385,
"message": "'Foo' is deprecated.",
"reportsDeprecated": true,
"range": ranges[31]
},
{
"code": 6385,
"message": "'QW' is deprecated.",
"reportsDeprecated": true,
"range": ranges[32]
},
{
"code": 6196,
"message": "'O' is declared but never used.",
"reportsUnnecessary": true,
"range": ranges[33]
}
])
| {
"end_byte": 7220,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion1.ts"
} |
TypeScript/tests/cases/fourslash/callHierarchyAccessor.ts_0_262 | /// <reference path="fourslash.ts" />
//// function foo() {
//// new C().bar;
//// }
////
//// class C {
//// get /**/bar() {
//// return baz();
//// }
//// }
////
//// function baz() {
//// }
goTo.marker();
verify.baselineCallHierarchy();
| {
"end_byte": 262,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyAccessor.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsSymbols1.ts_0_1427 | /// <reference path="fourslash.ts"/>
////class C {
//// [Symbol.isRegExp] = 0;
//// [Symbol.iterator]() { }
//// get [Symbol.isConcatSpreadable]() { }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "C",
"kind": "class",
"childItems": [
{
"text": "[Symbol.isRegExp]",
"kind": "property"
},
{
"text": "[Symbol.iterator]",
"kind": "method"
},
{
"text": "[Symbol.isConcatSpreadable]",
"kind": "getter"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "C",
"kind": "class"
}
]
},
{
"text": "C",
"kind": "class",
"childItems": [
{
"text": "[Symbol.isRegExp]",
"kind": "property"
},
{
"text": "[Symbol.iterator]",
"kind": "method"
},
{
"text": "[Symbol.isConcatSpreadable]",
"kind": "getter"
}
],
"indent": 1
}
]);
| {
"end_byte": 1427,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsSymbols1.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportAllowSyntheticDefaultImports5.ts_0_365 | /// <reference path="fourslash.ts" />
// @AllowSyntheticDefaultImports: false
// @Module: umd
// @Filename: a/f1.ts
//// [|export var x = 0;
//// bar/*0*/();|]
// @Filename: a/foo.d.ts
//// declare function bar(): number;
//// export = bar;
//// export as namespace bar;
verify.importFixAtPosition([
`import bar = require("./foo");
export var x = 0;
bar();`
]); | {
"end_byte": 365,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportAllowSyntheticDefaultImports5.ts"
} |
TypeScript/tests/cases/fourslash/completionConstructorKeywordAfterPropertyDeclaration.ts_0_1904 | /// <reference path="fourslash.ts" />
//// // situations that `constructor` is partly present
//// class A {
//// blah; con/*1*/
//// }
//// class B {
//// blah
//// con/*2*/
//// }
//// class C {
//// blah: number
//// con/*3*/
//// }
//// class D {
//// blah = 123
//// con/*4*/
//// }
//// class E {
//// blah = [123]
//// con/*5*/
//// }
//// class F {
//// blah = {key: 123}
//// con/*6*/
//// }
//// // situations that `constructor` is fully present
//// class G {
//// blah; constructor/*7*/
//// }
//// class H {
//// blah
//// constructor/*8*/
//// }
//// class I {
//// blah: number
//// constructor/*9*/
//// }
//// class J {
//// blah = 123
//// constructor/*10*/
//// }
//// class K {
//// blah = [123]
//// constructor/*11*/
//// }
//// class L {
//// blah = {key: 123}
//// constructor/*12*/
//// }
//// // situations that `constructor` isn't present, but we should offer it
//// class M {
//// blah; /*13*/
//// }
//// class N {
//// blah
//// /*14*/
//// }
//// // situations that `constructor` should not be suggested
//// class O {
//// blah /*15*/
//// }
//// class P {
//// blah con/*16*/
//// }
//// class Q {
//// blah: number con/*17*/
//// }
//// class R {
//// blah = 123 con/*18*/
//// }
//// class S {
//// blah = {key: 123} con/*19*/
//// }
//// type SomeType = number
//// class T {
//// blah: SomeType con/*20*/
//// }
//// const SomeValue = 123
//// class U {
//// blah = SomeValue con/*21*/
//// }
function generateRange(l: number, r: number) {
return Array.from(Array(r - l + 1), (_, i) => String(i + l)); // [l, r]
}
verify.completions({
marker: generateRange(1, 14),
includes: { name: "constructor", sortText: completion.SortText.GlobalsOrKeywords },
isNewIdentifierLocation: true,
});
verify.completions({
marker: generateRange(15, 21),
exact: [],
isNewIdentifierLocation: true,
});
| {
"end_byte": 1904,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionConstructorKeywordAfterPropertyDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnAccessors02.ts_0_228 | /// <reference path='fourslash.ts' />
////class Foo {
//// get foo() {
////{| "indent": 8 |}
test.markers().forEach(marker => {
verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indent);
});
| {
"end_byte": 228,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnAccessors02.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_importType.ts_0_1452 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: /a.js
//// export const x = 0;
//// export class C {}
//// /** @typedef {number} T */
// @Filename: /b.js
//// export const m = 0;
//// /** @type {/*0*/} */
//// /** @type {/*1*/} */
verify.completions({
marker: ["0", "1"],
includes: [
{
name: "C",
source: "/a",
sourceDisplay: "./a",
text: "class C",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "T",
source: "/a",
sourceDisplay: "./a",
text: "type T = number",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
],
excludes: "x",
preferences: {
includeCompletionsForModuleExports: true,
},
});
// Something with a value-side will get a normal import.
verify.applyCodeActionFromCompletion("0", {
name: "C",
source: "/a",
description: `Add import from "./a"`,
newFileContent:
`import { C } from "./a";
export const m = 0;
/** @type {} */
/** @type {} */`,
});
// A pure type will get `import().T`
verify.applyCodeActionFromCompletion("1", {
name: "T",
source: "/a",
description: `Change 'T' to 'import("./a").T'`,
newFileContent:
`import { C } from "./a";
export const m = 0;
/** @type {} */
/** @type {import("./a").} */`,
});
| {
"end_byte": 1452,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_importType.ts"
} |
TypeScript/tests/cases/fourslash/contextualTypingOfGenericCallSignatures2.ts_0_330 | /// <reference path='fourslash.ts'/>
////interface I {
//// <T>(x: T): void
////}
////function f6(x: <T extends I>(p: T) => void) { }
////// x should not be contextually typed so this should be an error
////f6(/**/x => x<number>())
verify.quickInfoAt("", "(parameter) x: T extends I");
verify.numberOfErrorsInCurrentFile(1);
| {
"end_byte": 330,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/contextualTypingOfGenericCallSignatures2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixTopLevelForAwait_target_noTsConfig.ts_0_171 | /// <reference path="fourslash.ts" />
// @filename: /dir/a.ts
////declare const p: number[];
////for await (const _ of p);
////export {};
verify.not.codeFixAvailable();
| {
"end_byte": 171,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelForAwait_target_noTsConfig.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_shorthandProperty.ts_0_771 | /// <reference path='fourslash.ts' />
// @Filename: f.ts
////function /*a*/f/*b*/(a: number, b: number, ...rest: string[]) { }
////const a = 4;
////const b = 5;
////f(a, b);
////const rest = ["a", "b", "c"];
////f(a, b, ...rest);
////f(/** a */ a /** aa */, /** b */ b /** bb */);
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `function f({ a, b, rest = [] }: { a: number; b: number; rest?: string[]; }) { }
const a = 4;
const b = 5;
f({ a, b });
const rest = ["a", "b", "c"];
f({ a, b, rest: [...rest] });
f({ /** a */ a /** aa */, /** b */ b /** bb */ });`
}); | {
"end_byte": 771,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_shorthandProperty.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts_0_1079 | /// <reference path="fourslash.ts" />
// @module: commonjs
// @Filename: /node_modules/@types/node/index.d.ts
//// declare module "fs" { function writeFile(): void }
//// declare module "fs/promises" { function writeFile(): Promise<void> }
//// declare module "node:fs" { export * from "fs"; }
//// declare module "node:fs/promises" { export * from "fs/promises"; }
// @Filename: /index.ts
//// write/**/
verify.completions({
marker: "",
exact: completion.globalsPlus([{
name: "writeFile",
source: "fs",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}, {
name: "writeFile",
source: "node:fs",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}, {
name: "writeFile",
source: "fs/promises",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}, {
name: "writeFile",
source: "node:fs/promises",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}]),
preferences: {
includeCompletionsForModuleExports: true,
},
});
| {
"end_byte": 1079,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules1.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport18.ts_0_520 | /// <reference path='fourslash.ts' />
// Should give completions for modules referenced via baseUrl and paths compiler options with explicit name mappings
// @Filename: tsconfig.json
//// {
//// "compilerOptions": {
//// "paths": {
//// "/*": ["./*"]
//// },
//// }
//// }
// @Filename: test0.ts
//// import * as foo1 from "/path/w/*first*/
// @Filename: path/whatever.ts
//// export {}
verify.completions({ marker: ["first"], exact: ["whatever"], isNewIdentifierLocation: true });
| {
"end_byte": 520,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport18.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingParam12.ts_0_256 | /// <reference path="fourslash.ts" />
////function f([|cb = () => {}|]) {
//// cb("");
////}
verify.codeFix({
description: [ts.Diagnostics.Add_missing_parameter_to_0.message, "cb"],
index: 0,
newRangeContent: "cb = (p0: string) => {}"
});
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam12.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM3.ts_0_508 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: types/dep.d.ts
//// export declare class Dep {}
// @Filename: index.js
//// import fs from 'fs';
//// const path = require('path');
////
//// Dep/**/
// @Filename: util2.js
//// export {};
// When current file has both imports and requires, get import style from other files
goTo.marker("");
verify.importFixAtPosition([`import fs from 'fs';
import { Dep } from './types/dep';
const path = require('path');
Dep`]); | {
"end_byte": 508,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM3.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterface_05.ts_0_344 | /// <reference path='fourslash.ts'/>
// Should go to function literals that implement the interface within type assertions when invoked on an interface
//// interface Fo/*interface_definition*/o {
//// (a: number): void
//// }
////
//// let bar2 = <Foo> [|function(a) {}|];
////
verify.baselineGoToImplementation("interface_definition"); | {
"end_byte": 344,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_05.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsConflictMarkers2.ts_0_587 | /// <reference path="fourslash.ts"/>
////<<<<<<< HEAD
////class C { }
////=======
////class D { }
////>>>>>>> Branch - a
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("<<<<<<< HEAD"),
c.keyword("class"), c.className("C"), c.punctuation("{"), c.punctuation("}"),
c.comment("======="),
c.keyword("class"), c.identifier("D"), c.punctuation("{"), c.punctuation("}"),
c.comment(">>>>>>> Branch - a"));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "C"),
);
| {
"end_byte": 587,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsConflictMarkers2.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.