_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/completionListInObjectBindingPattern05.ts_0_242 | /// <reference path='fourslash.ts'/>
////interface I {
//// property1: number;
//// property2: string;
////}
////
////var foo: I;
////var { property1/**/ } = foo;
verify.completions({ marker: "", exact: ["property1", "property2"] });
| {
"end_byte": 242,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectBindingPattern05.ts"
} |
TypeScript/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts_0_385 | /// <reference path="fourslash.ts" />
////interface I<TString, TNumber> {
//// [s: string]: TString;
//// [s: number]: TNumber;
////}
////
////declare function foo<TString, TNumber>(obj: I<TString, TNumber>): { /*1*/ }
verify.completions({
marker: "1",
exact: { name: "readonly", sortText: completion.SortText.GlobalsOrKeywords },
isNewIdentifierLocation: true
});
| {
"end_byte": 385,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInClosedObjectTypeLiteralInSignature04.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts_0_441 | /// <reference path="fourslash.ts" />
////interface I<TString, TNumber> {
//// [s: string]: TString;
//// [s: number]: TNumber;
////}
////
////declare function foo<TString, TNumber>(obj: I<TString, TNumber>): { str: TStr/*1*/
verify.completions({
marker: "1",
includes: ["I", "TString", "TNumber"], // REVIEW: Is TNumber intended behavior?
excludes: ["foo", "obj"], // These shouldn't show up since they're not types.
})
| {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts"
} |
TypeScript/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts_0_2044 | /// <reference path='fourslash.ts'/>
// @Filename: genericFunctionSignatureHelp_0.ts
////function foo1<T>(x: number, callback: (y1: T) => number) { }
// @Filename: genericFunctionSignatureHelp_1.ts
////function foo2<T>(x: number, callback: (y2: T) => number) { }
// @Filename: genericFunctionSignatureHelp_2.ts
////function foo3<T>(x: number, callback: (y3: T) => number) { }
// @Filename: genericFunctionSignatureHelp_3.ts
////function foo4<T>(x: number, callback: (y4: T) => number) { }
// @Filename: genericFunctionSignatureHelp_4.ts
////function foo5<T>(x: number, callback: (y5: T) => number) { }
// @Filename: genericFunctionSignatureHelp_5.ts
////function foo6<T>(x: number, callback: (y6: T) => number) { }
// @Filename: genericFunctionSignatureHelp_6.ts
////function foo7<T>(x: number, callback: (y7: T) => number) { }
// @Filename: genericFunctionSignatureHelp_7.ts
////foo1(/*1*/ // signature help shows y as T
////foo2(1,/*2*/ // signature help shows y as {}
////foo3(1, (/*3*/ // signature help shows y as T
////foo4<string>(1,/*4*/ // signature help shows y as string
////foo5<string>(1, (/*5*/ // signature help shows y as T
////foo6(1, </*6*/ // signature help shows y as {}
////foo7(1, <string>(/*7*/ // signature help shows y as T
verify.signatureHelp(
{ marker: "1", text: "foo1(x: number, callback: (y1: unknown) => number): void" },
{ marker: "2", text: "foo2(x: number, callback: (y2: unknown) => number): void" },
{ marker: "3", text: "callback(y3: unknown): number" },
{ marker: "4", text: "foo4(x: number, callback: (y4: string) => number): void" },
{ marker: "5", text: "callback(y5: string): number" },
);
goTo.marker('6');
verify.signatureHelp({ text: "foo6(x: number, callback: (y6: unknown) => number): void" });
edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests
verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: unknown) => number): void" })
| {
"end_byte": 2044,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericFunctionSignatureHelp3MultiFile.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateSingleQuote.ts_0_679 | /// <reference path='fourslash.ts' />
//// const foo = '/*x*/f/*y*/oobar rocks'
goTo.select("x", "y");
verify.not.refactorAvailable(ts.Diagnostics.Convert_to_template_string.message);
verify.refactorAvailableForTriggerReason("invoked", ts.Diagnostics.Convert_to_template_string.message);
verify.not.refactorAvailableForTriggerReason("implicit", ts.Diagnostics.Convert_to_template_string.message);
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
triggerReason: "invoked",
newContent:
`const foo = \`foobar rocks\``,
});
| {
"end_byte": 679,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateSingleQuote.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToMappedObjectType9.ts_0_487 | /// <reference path='fourslash.ts' />
//// type K = "foo" | "bar";
//// interface Foo { }
//// interface Bar<T> { bar: T; }
//// interface SomeType extends Foo, Bar<number> {
//// a: number;
//// [prop: K]: any;
//// }
verify.codeFix({
description: `Convert 'SomeType' to mapped object type`,
newFileContent: `type K = "foo" | "bar";
interface Foo { }
interface Bar<T> { bar: T; }
type SomeType = Foo & Bar<number> & {
[prop in K]: any;
} & {
a: number;
};`
})
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToMappedObjectType9.ts"
} |
TypeScript/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts_0_1371 | /// <reference path="fourslash.ts"/>
////function overload1(a: string): boolean;
////function overload1(b: boolean): boolean;
////function overload1(b: number): boolean;
////
////var x= '?';
////
////function overload1(f: typeof overload): boolean;
////[|function overload1(x: any, b = (function overload() { return false })): boolean {
//// throw overload;
////}|]
////function overload2(a: string): boolean;
////function overload2(b: boolean): boolean;
////function overload2(b: number): boolean;
////
////function y(x: any, b = (function overload() { return false })): boolean {
//// throw overload;
////}
////
////function overload2(f: typeof overload): boolean;
////[|function overload2(x: any, b = (function overload() { return false })): boolean {
//// throw overload;
////}|]
const [r0, r1] = test.ranges();
const overload1: FourSlashInterface.ExpectedNavigateToItem =
{ name: "overload1", kind: "function", range: r0 };
const overload2: FourSlashInterface.ExpectedNavigateToItem =
{ name: "overload2", kind: "function", range: r1 };
verify.navigateTo(
{
pattern: "overload1",
expected: [overload1],
},
{
pattern: "overload2",
expected: [overload2],
},
{
pattern: "overload",
expected: [{ ...overload1, matchKind: "prefix" }, { ...overload2, matchKind: "prefix" }],
}
);
| {
"end_byte": 1371,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsOverloadsBroken1.ts"
} |
TypeScript/tests/cases/fourslash/memberlistOnDDot.ts_0_159 | /// <reference path='fourslash.ts' />
////var q = '';
////q/**/
goTo.marker();
edit.insert('.');
edit.insert('.');
verify.completions({ exact: undefined });
| {
"end_byte": 159,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberlistOnDDot.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageJsonImportsPattern.ts_0_339 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /package.json
//// {
//// "imports": {
//// "#*": "./src/*"
//// }
//// }
// @Filename: /src/something.ts
//// export function something(name: string): any;
// @Filename: /a.ts
//// something/**/
verify.importFixModuleSpecifiers("", ["#something.js"]);
| {
"end_byte": 339,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonImportsPattern.ts"
} |
TypeScript/tests/cases/fourslash/completionsThisProperties_globalType.ts_0_697 | /// <reference path="fourslash.ts" />
// #37091
// @lib: dom
// @allowJs: true
// @Filename: globals.d.ts
//// declare var global: { console: Console };
// @Filename: index.js
//// window.f = function() { console/*1*/ }
//// self.g = function() { console/*2*/ }
//// global.h = function() { console/*3*/ }
//// globalThis.i = function() { console/*4*/ }
test.markerNames().forEach(marker => {
verify.completions({
marker,
includes: [{
name: "console",
insertText: undefined,
kind: "var",
kindModifiers: "declare",
sortText: completion.SortText.GlobalsOrKeywords
}]
}, {
preferences: {
includeInsertTextCompletions: true
}
});
});
| {
"end_byte": 697,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsThisProperties_globalType.ts"
} |
TypeScript/tests/cases/fourslash/linkedEditingJsxTag11.ts_0_439 | /// <reference path='fourslash.ts' />
// @Filename: /customElements.tsx
//// const jsx = <fbt:enum knownProp="accepted"
//// unknownProp="rejected">
//// </fbt:enum>;
////
//// const customElement = <custom-element></custom-element>;
////
//// const standardElement =
//// <Link href="/hello" passHref>
//// <Button component="a">
//// Next
//// </Button>
//// </Link>;
verify.baselineLinkedEditing(); | {
"end_byte": 439,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/linkedEditingJsxTag11.ts"
} |
TypeScript/tests/cases/fourslash/outliningForNonCompleteInterfaceDeclaration.ts_0_118 | /// <reference path="fourslash.ts"/>
////interface I[||]
// should not crash
verify.outliningSpansInCurrentFile([]); | {
"end_byte": 118,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/outliningForNonCompleteInterfaceDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange11.ts_0_670 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////const b = 2;
// @Filename: /a.ts
////const a = 1;
////function[| add(x: number, y: number): number;
////function add(x: string, y: string): string;
////function add(x: any, y: any) {
//// return x + y;
////}
////
//// |]const b = 2;
////const c = 3;
verify.moveToFile({
newFileContents: {
"/a.ts":
`const a = 1;
const b = 2;
const c = 3;`,
"/bar.ts":
`const b = 2;
function add(x: number, y: number): number;
function add(x: string, y: string): string;
function add(x: any, y: any) {
return x + y;
}
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
});
| {
"end_byte": 670,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange11.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts_0_1004 | /// <reference path='fourslash.ts'/>
// Should handle union and intersection types
//// interface BaseFoo {
//// hello(): void;
//// }
////
//// interface Foo extends BaseFoo {
//// aloha(): void;
//// }
////
//// interface Bar {
//// hello(): void;
//// goodbye(): void;
//// }
////
//// class FooImpl implements Foo {
//// [|hello|]() {/**FooImpl*/}
//// aloha() {}
//// }
////
//// class BaseFooImpl implements BaseFoo {
//// hello() {/**BaseFooImpl*/} // Should not show up
//// }
////
//// class BarImpl implements Bar {
//// [|hello|]() {/**BarImpl*/}
//// goodbye() {}
//// }
////
//// class FooAndBarImpl implements Foo, Bar {
//// [|hello|]() {/**FooAndBarImpl*/}
//// aloha() {}
//// goodbye() {}
//// }
////
//// function someFunction(x: Foo | Bar) {
//// x.he/*function_call0*/llo();
//// }
////
//// function anotherFunction(x: Foo & Bar) {
//// x.he/*function_call1*/llo();
//// }
verify.baselineGoToImplementation("function_call0", "function_call1"); | {
"end_byte": 1004,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterfaceMethod_10.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts_0_235 | /// <reference path='fourslash.ts'/>
// @Filename: b.ts
////import n = require([|'e/*1*/'|]);
////var x = new n.Foo();
// @Filename: a.ts
////declare module /*2*/"e" {
//// class Foo { }
////}
verify.baselineGoToDefinition("1");
| {
"end_byte": 235,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionExternalModuleName3.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts_0_455 | /// <reference path='fourslash.ts'/>
// Should return implementations in a simple class
//// interface Foo {
//// hel/*declaration*/lo(): void;
//// okay?: number;
//// }
////
//// class Bar implements Foo {
//// [|hello|]() {}
//// public sure() {}
//// }
////
//// function whatever(a: Foo) {
//// a.he/*function_call*/llo();
//// }
////
//// whatever(new Bar());
verify.baselineGoToImplementation("function_call", "declaration"); | {
"end_byte": 455,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts"
} |
TypeScript/tests/cases/fourslash/extract-const_jsxSelfClosingElement2.ts_0_556 | /// <reference path='fourslash.ts' />
// @jsx: preserve
// @filename: a.tsx
////function Foo() {
//// return (
//// <div>
//// /*a*/<br />/*b*/
//// </div>
//// );
////}
goTo.file("a.tsx");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`function Foo() {
const /*RENAME*/newLocal = <br />;
return (
<div>
{newLocal}
</div>
);
}`
});
| {
"end_byte": 556,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const_jsxSelfClosingElement2.ts"
} |
TypeScript/tests/cases/fourslash/insertPublicBeforeSetter.ts_0_180 | /// <reference path="fourslash.ts" />
//// class C {
//// /**/set Bar(bar:string) {}
//// }
//// var o2 = { set Foo(val:number) { } };
goTo.marker();
edit.insert("public ");
| {
"end_byte": 180,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/insertPublicBeforeSetter.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete5.ts_0_449 | /// <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: "templateStrings",
parameterSpan: "templateStrings: any",
});
| {
"end_byte": 449,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete5.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTemplateLiteralParts1.ts_0_338 | /// <reference path="fourslash.ts" />
/////*0*/` $ { ${/*1*/ 10/*2*/ + 1.1/*3*/ /*4*/} 12312`/*5*/
////
/////*6*/`asdasd${/*7*/ 2 + 1.1 /*8*/} 12312 {
verify.completions(
{ marker: ["1", "7"], exact: completion.globals, isNewIdentifierLocation: true },
{ marker: ["2", "3", "4", "5", "6", "8"], exact: completion.globals },
);
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTemplateLiteralParts1.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_prologueDirectives4.ts_0_139 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////function foo() {
//// [|"use strict";|]
////}
verify.noMoveToNewFile();
| {
"end_byte": 139,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_prologueDirectives4.ts"
} |
TypeScript/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts_0_169 | /// <reference path="fourslash.ts" />
////function alpha() {
//// var x = "x\
////
//// /**/
//// var y = 1;
////}
verify.not.errorExistsAfterMarker(); | {
"end_byte": 169,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unclosedMultilineStringLiteralErrorRecovery.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_exportEquals.ts_0_428 | /// <reference path="fourslash.ts" />
// @Filename: /a.d.ts
////declare function a(): void;
////declare namespace a {
//// export interface b {}
////}
////export = a;
// @Filename: /b.ts
////a;
////let x: b;
goTo.file("/b.ts");
verify.codeFixAll({
fixId: "fixMissingImport",
fixAllDescription: "Add all missing imports",
newFileContent:
`import { b } from "./a";
import a = require("./a");
a;
let x: b;`,
});
| {
"end_byte": 428,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_exportEquals.ts"
} |
TypeScript/tests/cases/fourslash/errorInIncompleteMethodInObjectLiteral.ts_0_114 | /// <reference path='fourslash.ts'/>
//// var x: { f(): string } = { f( }
verify.numberOfErrorsInCurrentFile(1); | {
"end_byte": 114,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/errorInIncompleteMethodInObjectLiteral.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess8.ts_0_523 | /// <reference path='fourslash.ts' />
//// class A {
//// /*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 {
private /*RENAME*/_a: string = "foo";
public get a(): string {
return this._a;
}
public set a(value: string) {
this._a = value;
}
}`,
});
| {
"end_byte": 523,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToGetAccessAndSetAccess8.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpInRecursiveType.ts_0_506 | /// <reference path='fourslash.ts'/>
////type Tail<T extends any[]> =
//// ((...args: T) => any) extends ((head: any, ...tail: infer R) => any) ? R : never;
////
////type Reverse<List extends any[]> = _Reverse<List, []>;
////
////type _Reverse<Source extends any[], Result extends any[] = []> = {
//// 1: Result,
//// 0: _Reverse<Tail<Source>, 0>,
////}[Source extends [] ? 1 : 0];
////
////type Foo = Reverse<[0,/**/]>;
verify.signatureHelp({
marker: "",
text: "Reverse<List extends any[]>",
}); | {
"end_byte": 506,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpInRecursiveType.ts"
} |
TypeScript/tests/cases/fourslash/aliasToVarUsedAsType.ts_0_158 | /// <reference path="fourslash.ts" />
//// /**/
//// module A {
//// export var X;
//// import Z = A.X;
//// var v: Z;
//// }
goTo.marker();
edit.insert(' '); | {
"end_byte": 158,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/aliasToVarUsedAsType.ts"
} |
TypeScript/tests/cases/fourslash/jsdocLink5.ts_0_324 | ///<reference path="fourslash.ts" />
//// function g() { }
//// /**
//// * {@link g()} {@link g() } {@link g ()} {@link g () 0} {@link g()1} {@link g() 2}
//// * {@link u()} {@link u() } {@link u ()} {@link u () 0} {@link u()1} {@link u() 2}
//// */
//// function f(x) {
//// }
//// f/*3*/()
verify.baselineQuickInfo();
| {
"end_byte": 324,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocLink5.ts"
} |
TypeScript/tests/cases/fourslash/codeFixExtendsInterfaceBecomesImplements_all.ts_0_340 | /// <reference path='fourslash.ts' />
////interface I {}
////class C extends I {}
////class D extends I {}
verify.codeFixAll({
fixId: "extendsInterfaceBecomesImplements",
fixAllDescription: "Change all extended interfaces to 'implements'",
newFileContent: `interface I {}
class C implements I {}
class D implements I {}`,
});
| {
"end_byte": 340,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixExtendsInterfaceBecomesImplements_all.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateNamespacesAndModules01.ts_0_419 | /// <reference path='fourslash.ts' />
/////*namespaceN*/
////namespace n {
////}
////
/////*namespaceM*/
////module m {
////}
////
/////*ambientModule*/
////module "ambientModule" {
////}
verify.docCommentTemplateAt("namespaceN", /*indentation*/ 3,
"/** */");
verify.docCommentTemplateAt("namespaceM", /*indentation*/ 3,
"/** */");
verify.docCommentTemplateAt("namespaceM", /*indentation*/ 3,
"/** */"); | {
"end_byte": 419,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateNamespacesAndModules01.ts"
} |
TypeScript/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard1.ts_0_1322 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/foo/package.json
//// {
//// "name": "foo",
//// "main": "dist/index.js",
//// "module": "dist/index.mjs",
//// "types": "dist/index.d.ts",
//// "exports": {
//// ".": {
//// "types": "./dist/index.d.ts",
//// "import": "./dist/index.mjs",
//// "default": "./dist/index.js"
//// },
//// "./*": {
//// "types": "./dist/*.d.ts",
//// "import": "./dist/*.mjs",
//// "default": "./dist/*.js"
//// },
//// "./arguments": {
//// "types": "./dist/arguments/index.d.ts",
//// "import": "./dist/arguments/index.mjs",
//// "default": "./dist/arguments/index.js"
//// }
//// }
//// }
// @Filename: /node_modules/foo/dist/index.d.ts
//// export const index = 0;
// @Filename: /node_modules/foo/dist/blah.d.ts
//// export const blah = 0;
// @Filename: /node_modules/foo/dist/arguments/index.d.ts
//// export const arguments = 0;
// @Filename: /index.mts
//// import { } from "foo//**/";
verify.completions({
marker: "",
isNewIdentifierLocation: true,
exact: [
{ name: "blah", kind: "script", kindModifiers: "" },
{ name: "index", kind: "script", kindModifiers: "" },
{ name: "arguments", kind: "script", kindModifiers: "" },
]
});
| {
"end_byte": 1322,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard1.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectBindingPattern14.ts_0_175 | /// <reference path="fourslash.ts"/>
////const { b/**/ } = new class {
//// private ab;
//// protected bc;
////}
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 175,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectBindingPattern14.ts"
} |
TypeScript/tests/cases/fourslash/jsDocSee2.ts_0_689 | ///<reference path="fourslash.ts" />
//// /** @see {/*use1*/[|foooo|]} unknown reference*/
//// const a = ""
//// /** @see {/*use2*/[|@bar|]} invalid tag*/
//// const b = ""
//// /** @see /*use3*/[|foooo|] unknown reference without brace*/
//// const c = ""
//// /** @see /*use4*/[|@bar|] invalid tag without brace*/
//// const [|/*def1*/d|] = ""
//// /** @see {/*use5*/[|d@fff|]} partial reference */
//// const e = ""
//// /** @see /*use6*/[|@@@@@@|] total invalid tag*/
//// const f = ""
//// /** @see d@{/*use7*/[|fff|]} partial reference */
//// const g = ""
verify.baselineGoToDefinition(
"use1",
"use2",
"use3",
"use4",
"use5",
"use6",
"use7",
); | {
"end_byte": 689,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocSee2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction10.ts_0_360 | /// <reference path='fourslash.ts' />
// @target: esnext
////const f: () => number | string = () => {
//// await Promise.resolve('foo');
////}
verify.codeFix({
index: 2,
description: "Add async modifier to containing function",
newFileContent:
`const f: () => Promise<number | string> = async () => {
await Promise.resolve('foo');
}`
});
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction10.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_multipleWithSameName.ts_0_1539 | /// <reference path="fourslash.ts" />
// @module: esnext
// @noLib: true
// @Filename: /global.d.ts
// A local variable would prevent import completions (see `completionsImport_shadowedByLocal.ts`), but a global doesn't.
////declare var foo: number;
// @Filename: /a.ts
////export const foo = 0;
// @Filename: /b.ts
////export const foo = 1;
// @Filename: /c.ts
////fo/**/
goTo.marker("");
verify.completions({
marker: "",
exact: completion.globalsPlus([
{
name: "foo",
text: "var foo: number",
kind: "var",
kindModifiers: "declare",
sortText: completion.SortText.GlobalsOrKeywords
},
{
name: "foo",
source: "/a",
sourceDisplay: "./a",
text: "const foo: 0",
kind: "const",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "foo",
source: "/b",
sourceDisplay: "./b",
text: "const foo: 1",
kind: "const",
kindModifiers: "export",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
], { noLib: true }),
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "foo",
source: "/b",
description: `Add import from "./b"`,
newFileContent: `import { foo } from "./b";
fo`,
});
| {
"end_byte": 1539,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_multipleWithSameName.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts_0_342 | /// <reference path='fourslash.ts'/>
////interface I {
//// /*0*/property1: number;
//// property2: string;
////}
////
////function f({ /*1*/property1: p1 }: I,
//// { /*2*/property1 }: I,
//// { property1: p2 }) {
////
//// return /*3*/property1 + 1;
////}
verify.baselineFindAllReferences('0', '1', '2', '3')
| {
"end_byte": 342,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName04.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralExpressions4.ts_0_968 | /// <reference path="fourslash.ts" />
////interface T {
//// aaa: number;
//// bbb?: number;
//// }
//// const obj: T = {
//// aaa: 1 * (2 + 3)
//// /**/
//// }
verify.completions({
marker: "",
includes: [{
name: "bbb",
sortText: completion.SortText.OptionalMember,
hasAction: true,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
}],
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
verify.applyCodeActionFromCompletion("", {
name: "bbb",
description: `Add missing comma for object member completion 'bbb'.`,
source: completion.CompletionSource.ObjectLiteralMemberWithComma,
newFileContent:
`interface T {
aaa: number;
bbb?: number;
}
const obj: T = {
aaa: 1 * (2 + 3),
}`,
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 968,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralExpressions4.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow_arguments.ts_0_469 | /// <reference path='fourslash.ts' />
////function foo() {
//// return /*a*/f/*b*/unction () { arguments }
////}
goTo.select("a", "b");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to named function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to anonymous function");
verify.not.refactorAvailable("Convert arrow function or function expression", "Convert to arrow function");
| {
"end_byte": 469,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_Availability_Arrow_arguments.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties10.ts_0_303 | /// <reference path='fourslash.ts' />
////type T = { x: number; };
////interface I {
//// a: T
////}
////[|const foo: I = {};|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`const foo: I = {
a: {
x: 0
}
};`
});
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties10.ts"
} |
TypeScript/tests/cases/fourslash/renameJsThisProperty01.ts_0_277 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: a.js
////function bar() {
//// [|this.[|{| "contextRangeIndex": 0 |}x|] = 10;|]
////}
////var t = new bar();
////[|t.[|{| "contextRangeIndex": 2 |}x|] = 11;|]
verify.baselineRenameAtRangesWithText("x");
| {
"end_byte": 277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsThisProperty01.ts"
} |
TypeScript/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts_0_271 | /// <reference path='fourslash.ts'/>
////interface IFoo<T> {
//// /*1*/doSomething(v: T): T;
////}
////
////var x: IFoo<string>;
////x./*2*/doSomething("ss");
////
////var y: IFoo<number>;
////y./*3*/doSomething(12);
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 271,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstToCommaSeparatedInitializer2.ts_0_224 | /// <reference path='fourslash.ts' />
////x = 0,
////y = 0;
verify.codeFixAll({
fixId: "addMissingConst",
fixAllDescription: "Add 'const' to all unresolved variables",
newFileContent: `const x = 0,
y = 0;`
});
| {
"end_byte": 224,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstToCommaSeparatedInitializer2.ts"
} |
TypeScript/tests/cases/fourslash/autoImportPackageJsonExportsSpecifierEndsInTs.ts_0_523 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/pkg/package.json
//// {
//// "name": "pkg",
//// "version": "1.0.0",
//// "exports": {
//// "./something.ts": "./a.js"
//// }
//// }
// @Filename: /node_modules/pkg/a.d.ts
//// export function foo(): void;
// @Filename: /package.json
//// {
//// "dependencies": {
//// "pkg": "*"
//// }
//// }
// @Filename: /index.ts
//// foo/**/
verify.importFixModuleSpecifiers("", ["pkg/something.ts"]);
| {
"end_byte": 523,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportPackageJsonExportsSpecifierEndsInTs.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoGenerics.ts_0_1930 | /// <reference path='fourslash.ts' />
////class Con/*1*/tainer<T> {
//// x: T;
////}
////interface IList</*2*/T> {
//// getItem(i: number): /*3*/T;
////}
////class List2</*4*/T extends IList<number>> implements IList<T> {
//// private __it/*6*/em: /*5*/T[];
//// public get/*7*/Item(i: number) {
//// return this.__item[i];
//// }
//// public /*8*/method</*9*/S extends IList<T>>(s: S, p: /*10*/T[]) {
//// return s;
//// }
////}
////function foo4</*11*/T extends Date>(test: T): T;
////function foo4</*12*/S extends string>(test: S): S;
////function foo4(test: any): any;
////function foo4</*13*/T extends Date>(test: any): any { return null; }
////var x: List2<IList<number>>;
////var y = x./*14*/getItem(10);
////var x2: IList<IList<number>>;
////var x3: IList<number>;
////var y2 = x./*15*/method(x2, [x3, x3]);
verify.quickInfos({
1: "class Container<T>",
2: "(type parameter) T in IList<T>",
3: "(type parameter) T in IList<T>",
4: "(type parameter) T in List2<T extends IList<number>>",
5: "(type parameter) T in List2<T extends IList<number>>",
6: "(property) List2<T extends IList<number>>.__item: T[]",
7: "(method) List2<T extends IList<number>>.getItem(i: number): T",
8: "(method) List2<T extends IList<number>>.method<S extends IList<T>>(s: S, p: T[]): S",
9: "(type parameter) S in List2<T extends IList<number>>.method<S extends IList<T>>(s: S, p: T[]): S",
10: "(type parameter) T in List2<T extends IList<number>>",
11: "(type parameter) T in foo4<T extends Date>(test: T): T",
12: "(type parameter) S in foo4<S extends string>(test: S): S",
13: "(type parameter) T in foo4<T extends Date>(test: any): any",
14: "(method) List2<IList<number>>.getItem(i: number): IList<number>",
15: "(method) List2<IList<number>>.method<IList<IList<number>>>(s: IList<IList<number>>, p: IList<number>[]): IList<IList<number>>"
});
| {
"end_byte": 1930,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoGenerics.ts"
} |
TypeScript/tests/cases/fourslash/exportInLabeledStatement.ts_0_212 | /// <reference path="fourslash.ts" />
// @Filename: a.ts
//// subTitle:
//// [|export|] const title: string
verify.baselineDocumentHighlights(test.ranges()[0], { filesToSearch: [test.ranges()[0].fileName] });
| {
"end_byte": 212,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/exportInLabeledStatement.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationSuper_01.ts_0_359 | /// <reference path='fourslash.ts'/>
// Should go to the super class declaration when invoked on the super keyword in a property access expression
//// class [|Foo|] {
//// hello() {}
//// }
////
//// class Bar extends Foo {
//// hello() {
//// sup/*super_call*/er.hello();
//// }
//// }
verify.baselineGoToImplementation("super_call"); | {
"end_byte": 359,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationSuper_01.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_parameter6.ts_0_381 | /// <reference path="fourslash.ts" />
// @noUnusedLocals: true
// @noUnusedParameters: true
////[|function f(
//// a: number,
//// b: number,
////
////
//// c: number,
////)|] {
//// a;
//// c;
////}
verify.codeFix({
index: 0,
description: "Remove unused declaration for: 'b'",
newRangeContent:
`function f(
a: number,
c: number,
)`
});
| {
"end_byte": 381,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_parameter6.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration21.ts_0_805 | /// <reference path="fourslash.ts" />
// @jsx: preserve
// @filename: foo.tsx
////interface P {
//// onClick: (a: number, b: string) => void;
////}
////
////const A = ({ onClick }: P) =>
//// <div onClick={onClick}></div>;
////
////const B = () => {
//// return (
//// <A onClick={handleClick}></A>
//// );
////}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "handleClick"],
newFileContent:
`interface P {
onClick: (a: number, b: string) => void;
}
const A = ({ onClick }: P) =>
<div onClick={onClick}></div>;
const B = () => {
function handleClick(a: number, b: string): void {
throw new Error("Function not implemented.");
}
return (
<A onClick={handleClick}></A>
);
}`
});
| {
"end_byte": 805,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration21.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoModuleVariables.ts_0_363 | /// <reference path="fourslash.ts"/>
////var x = 1;
////module M {
//// export var x = 2;
//// console.log(/*1*/x); // 2
////}
////module M {
//// console.log(/*2*/x); // 2
////}
////module M {
//// var x = 3;
//// console.log(/*3*/x); // 3
////}
verify.quickInfos({
1: "var M.x: number",
2: "var M.x: number",
3: "var x: number"
});
| {
"end_byte": 363,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoModuleVariables.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport12.ts_0_468 | /// <reference path="fourslash.ts" />
// @verbatimModuleSyntax: true
// @module: esnext
// @moduleResolution: bundler
// @target: esnext
// @filename: /a.ts
////export function f() {}
// @filename: /b.ts
////import { f } from "./a";
////export interface I {}
////type f = number;
////export { f };
// @filename: /c.ts
////import { I, f } from "./b";
////export { type I, f };
goTo.file("/c.ts");
verify.codeFixAvailable([
{ description: "Use 'type I'" },
]);
| {
"end_byte": 468,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport12.ts"
} |
TypeScript/tests/cases/fourslash/mapCodePlainJsInsertion.ts_0_254 | ///<reference path="fourslash.ts"/>
// @Filename: /topLevelInsert.js
//// function foo() {
//// return 1;
//// }[||]
//// function bar() {
//// return 2;
//// }
verify.baselineMapCode([test.ranges()], [
`
function baz() {
return 3;
}
`
]);
| {
"end_byte": 254,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/mapCodePlainJsInsertion.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralUnionTemplateLiteralType.ts_0_437 | /// <reference path="fourslash.ts" />
////type UnionType = {
//// key1: string;
////} | {
//// key2: number;
////} | `string literal ${string}`;
////
////const obj1: UnionType = {
//// /*1*/
////};
////
////const obj2: UnionType = {
//// key1: "abc",
//// /*2*/
////};
verify.completions({
marker: '1',
exact: [{ name: 'key1' }, { name: 'key2' }]
})
verify.completions({
marker: '2',
exact: [{ name: 'key2' }]
})
| {
"end_byte": 437,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralUnionTemplateLiteralType.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForRest.ts_0_245 | /// <reference path='fourslash.ts'/>
////interface Gen {
//// x: number
//// /*1*/parent: Gen;
//// millenial: string;
////}
////let t: Gen;
////var { x, ...rest } = t;
////rest./*2*/parent;
verify.baselineFindAllReferences('1', '2');
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForRest.ts"
} |
TypeScript/tests/cases/fourslash/tsxRename3.ts_0_490 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props }
//// }
//// class MyClass {
//// props: {
//// [|[|{| "contextRangeIndex": 0 |}name|]?: string;|]
//// size?: number;
//// }
////
////
//// var x = <MyClass [|[|{| "contextRangeIndex": 2 |}name|]='hello'|]/>;
verify.baselineRenameAtRangesWithText("name");
| {
"end_byte": 490,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxRename3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixTopLevelForAwait_module_missingCompilerOptionsInTsConfig.ts_0_286 | /// <reference path="fourslash.ts" />
// @filename: /dir/a.ts
////declare const p: number[];
////for await (const _ of p);
////export {};
// @filename: /dir/tsconfig.json
////{
////}
// cannot fix module when default options are applied
verify.not.codeFixAvailable("fixModuleOption");
| {
"end_byte": 286,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixTopLevelForAwait_module_missingCompilerOptionsInTsConfig.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesConst02.ts_0_349 | /// <reference path='fourslash.ts' />
////module m {
//// declare /*1*/const x;
//// declare [|const|] enum E {
//// }
////}
////
////declare /*2*/const x;
////declare [|const|] enum E {
////}
verify.baselineDocumentHighlights(); // They are in different scopes, so not counted together.
verify.baselineDocumentHighlights(test.markers()); | {
"end_byte": 349,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesConst02.ts"
} |
TypeScript/tests/cases/fourslash/completionsUniqueSymbol_import.ts_0_969 | /// <reference path="fourslash.ts" />
// @noLib: true
// @Filename: /globals.d.ts
////declare const Symbol: () => symbol;
// @Filename: /a.ts
////const privateSym = Symbol();
////export const publicSym = Symbol();
////export interface I {
//// [privateSym]: number;
//// [publicSym]: number;
//// [defaultPublicSym]: number;
//// n: number;
////}
////export const i: I;
// @Filename: /user.ts
////import { i } from "./a";
////i[|./**/|];
verify.completions({
marker: "",
exact: [
"n",
{ name: "publicSym", source: "/a", insertText: "[publicSym]", replacementSpan: test.ranges()[0], hasAction: true },
],
preferences: {
includeInsertTextCompletions: true,
includeCompletionsForModuleExports: true,
},
});
verify.applyCodeActionFromCompletion("", {
name: "publicSym",
source: "/a",
description: `Update import from "./a"`,
newFileContent:
`import { i, publicSym } from "./a";
i.;`
});
| {
"end_byte": 969,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsUniqueSymbol_import.ts"
} |
TypeScript/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction5.ts_0_366 | /// <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": 366,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorAddOrRemoveBracesToArrowFunction5.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInheritDoc4.ts_0_273 | /// <reference path="fourslash.ts" />
// @Filename: quickInfoInheritDoc4.ts
////var A: any;
////
////class B extends A {
//// /**
//// * @inheritdoc
//// */
//// static /**/value() {
//// return undefined;
//// }
////}
verify.baselineQuickInfo();
| {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInheritDoc4.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentModule.ts_0_215 | /// <reference path='fourslash.ts'/>
////module Foo {
//// /*insideModule*/
////}
/////*afterModule*/
goTo.marker('insideModule');
verify.indentationIs(4);
goTo.marker('afterModule');
verify.indentationIs(0);
| {
"end_byte": 215,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentModule.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties24.ts_0_463 | /// <reference path="fourslash.ts" />
////interface A {
//// a: number;
//// b: string;
////}
////interface B {
//// c: boolean;
////}
////interface C {
//// a: A;
//// b: B;
////}
////function f<T extends keyof C>(type: T, obj: C[T]): string {
//// return "";
////}
////[|f("a", {});|]
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`f("a", {
a: 0,
b: ""
});`,
});
| {
"end_byte": 463,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties24.ts"
} |
TypeScript/tests/cases/fourslash/organizeImportsPathsUnicode2.ts_0_764 | /// <reference path="fourslash.ts" />
//// import * as a2 from "./a2";
//// import * as a100 from "./a100";
//// import * as a1 from "./a1";
////
//// console.log(a1, a2, a100);
verify.organizeImports(
`import * as a1 from "./a1";
import * as a100 from "./a100";
import * as a2 from "./a2";
console.log(a1, a2, a100);`, /*mode*/ undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "unicode",
organizeImportsNumericCollation: false,
});
verify.organizeImports(
`import * as a1 from "./a1";
import * as a2 from "./a2";
import * as a100 from "./a100";
console.log(a1, a2, a100);`, /*mode*/ undefined, {
organizeImportsIgnoreCase: false,
organizeImportsCollation: "unicode",
organizeImportsNumericCollation: true,
});
| {
"end_byte": 764,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsPathsUnicode2.ts"
} |
TypeScript/tests/cases/fourslash/exportEqualsInterfaceA.ts_0_273 | /// <reference path="fourslash.ts" />
////// @Filename: exportEqualsInterface_A.ts
////interface A {
//// p1: number;
////}
////export = A;
/////**/
////var i: I1;
////var n: number = i.p1;
goTo.marker();
edit.insert('import I1 = require("exportEqualsInterface_A");'); | {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/exportEqualsInterfaceA.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInTypeAlias.ts_3_162 | / <reference path='fourslash.ts'/>
////type /*0*/List</*1*/T> = /*2*/T[]
////type /*3*/List2</*4*/T extends string> = /*5*/T[];
verify.baselineQuickInfo(); | {
"end_byte": 162,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInTypeAlias.ts"
} |
TypeScript/tests/cases/fourslash/autoImportFileExcludePatterns7.ts_0_979 | /// <reference path="fourslash.ts" />
// @Filename: /src/vs/workbench/test.ts
//// import { Parts } from './parts';
//// export class /**/EditorParts implements Parts { }
// @Filename: /src/vs/event/event.ts
//// export interface Event {
//// (): string;
//// }
// @Filename: /src/vs/workbench/parts.ts
//// import { Event } from '../event/event';
//// export interface Parts {
//// readonly options: Event;
//// }
// @Filename: /src/vs/workbench/workbench.ts
//// import { Event } from '../event/event';
//// export { Event };
// @Filename: /src/vs/workbench/workbench2.ts
//// import { Event } from '../event/event';
//// export { Event };
verify.codeFix({
description: "Implement interface 'Parts'",
newFileContent:
`import { Event } from '../event/event';
import { Parts } from './parts';
export class EditorParts implements Parts {
options: Event;
}`,
preferences: {
autoImportFileExcludePatterns: ["src/vs/workbench/workbench*"],
}
});
| {
"end_byte": 979,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportFileExcludePatterns7.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionVariableAssignment3.ts_0_239 | /// <reference path="fourslash.ts" />
// @filename: foo.ts
////const Foo = module./*def*/exports = function () {}
////Foo.prototype.bar = function() {}
////new [|Foo/*ref*/|]();
goTo.file("foo.ts");
verify.baselineGoToDefinition("ref");
| {
"end_byte": 239,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionVariableAssignment3.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts_0_409 | /// <reference path="fourslash.ts" />
// @Filename: /src/a.ts
////[|foo|]
// @Filename: /thisHasPathMapping.ts
////export function foo() {};
// @Filename: /tsconfig.json
////{
//// "compilerOptions": {
//// "baseUrl": "src",
//// "paths": {
//// "foo": ["..\\thisHasPathMapping"]
//// }
//// }
////}
verify.importFixAtPosition([
`import { foo } from "foo";
foo`
]);
| {
"end_byte": 409,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportPaths_withParentRelativePath.ts"
} |
TypeScript/tests/cases/fourslash/optionalPropertyFormatting.ts_0_246 | ///<reference path="fourslash.ts"/>
////export class C extends Error {
//// message: string;
//// data? = {};
////}
format.document();
verify.currentFileContentIs(
`export class C extends Error {
message: string;
data? = {};
}`);
| {
"end_byte": 246,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/optionalPropertyFormatting.ts"
} |
TypeScript/tests/cases/fourslash/stringCompletionsUnterminated2.ts_0_1610 | ///<reference path="fourslash.ts" />
// @Filename: test0.ts
//// type Test = 'test';
//// const test0: Test = `[|t/*0*/|]; // this comment should not be deleted
// @Filename: test1.ts
//// type Test = 'test';
//// const test1: Test = '[|t/*1*/|]; // this comment should not be deleted
// @Filename: test2.ts
//// type Test = 'test';
//// const test2: Test = "[|t/*2*/|] other stuff; // this comment should not be deleted
// @Filename: test3.ts
//// type Test = 'test';
//// const test3: Test = "[|t/*3*/|]es // this comment should not be deleted
// @Filename: test4.ts
//// type Test = 'test';
//// const test4: Test = "[|tes/*4*/|] // this comment should not be deleted
// @Filename: file5.ts
//// type Test = 'test';
//// const test5: {prop0: Test, prop1: number, prop2: number, } = { prop0: '[|t/*5*/|] ,prop1: 5, prop2: 2 };
// @Filename: file6.ts
//// type Test = 'test';
//// const test6: {prop0: Test, prop1: number, prop2: number, } = { prop0: '[|t/*6*/|]es ,prop1: 5, prop2: 2 };
// @Filename: test7.ts
//// type Test = 'test asdf';
//// const test7: Test = `[|test as/*7*/|]; // this comment should not be deleted
// @Filename: test8.ts
//// type Test = 'test asdf';
//// const test8: Test = `[|test/*8*/|] as; // this comment should not be deleted
const markers = test.markers();
const ranges = test.ranges();
for (let i = 0; i < markers.length; i++) {
verify.completions({
marker: markers[i],
includes: [{
"name": "test",
"kind": "string",
"kindModifiers": "",
"replacementSpan": ranges[i],
}],
});
}
| {
"end_byte": 1610,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringCompletionsUnterminated2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport1.ts_0_1002 | /// <reference path="fourslash.ts" />
// @module: esnext
// @verbatimModuleSyntax: true
// @Filename: exports.ts
////export default class A {}
////export class B {}
////export class C {}
// @Filename: imports.ts
////import {
//// B,
//// C,
////} from './exports';
////
////declare const b: B;
////declare const c: C;
////console.log(b, c);
goTo.file("imports.ts");
// This test previously showed that a codefix could be applied to turn
// these imports, only used in type positions, into type-only imports.
// The code fix was triggered by the error issued by
// `--importsNotUsedAsValues error`, for which there is no analog in
// the compiler after its removal. `verbatimModuleSyntax` does not
// error here since the imported names are values, and so will not
// crash at runtime. Users have replaced this error and codefix with
// an eslint rule. We could consider bringing it back as a suggestion
// diagnostic, a refactor, or an organizeImports feature.
verify.not.codeFixAvailable();
| {
"end_byte": 1002,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_callComments.ts_0_663 | /// <reference path='fourslash.ts' />
////function /*a*/foo/*b*/(a: number, b: number, ...rest: number[]) {
//// return a + b;
////}
////foo(/**a*/ 1 /**b*/, /**c*/ 2 /**d*/, /**e*/ 3 /**f*/, /**g*/ 4 /**h*/);
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 foo({ a, b, rest = [] }: { a: number; b: number; rest?: number[]; }) {
return a + b;
}
foo({ /**a*/ a: 1 /**b*/, /**c*/ b: 2 /**d*/, rest: [/**e*/ 3 /**f*/, /**g*/ 4 /**h*/] });`
}); | {
"end_byte": 663,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_callComments.ts"
} |
TypeScript/tests/cases/fourslash/autoImportBundlerExports.ts_0_424 | /// <reference path="fourslash.ts" />
// @module: esnext
// @moduleResolution: bundler
// @Filename: /node_modules/dep/package.json
//// {
//// "name": "dep",
//// "version": "1.0.0",
//// "exports": {
//// ".": "./dist/index.js"
//// }
//// }
// @Filename: /node_modules/dep/dist/index.d.ts
//// export const dep: number;
// @Filename: /index.ts
//// dep/**/
verify.importFixModuleSpecifiers("", ["dep"]);
| {
"end_byte": 424,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportBundlerExports.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultNamed.ts_0_127 | /// <reference path='fourslash.ts'/>
/////*1*/export /*2*/default /*3*/class /*4*/C /*5*/ {
////}
verify.baselineQuickInfo(); | {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoDisplayPartsClassDefaultNamed.ts"
} |
TypeScript/tests/cases/fourslash/refactorKind_rewriteFunction.ts_0_322 | /// <reference path='fourslash.ts' />
//// const arrow = /*a*//*b*/() => 1;
goTo.select("a", "b");
verify.refactorKindAvailable("refactor.rewrite", [
"refactor.rewrite.arrow.braces.add",
"refactor.rewrite.function.named",
"refactor.rewrite.function.anonymous",
"refactor.rewrite.function.returnType"
]);
| {
"end_byte": 322,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorKind_rewriteFunction.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsInferredTypePredicate1.ts_0_227 | /// <reference path="fourslash.ts" />
// @strict: true
//// function test(x: unknown) {
//// return typeof x === 'number';
//// }
verify.baselineInlayHints(undefined, {
includeInlayFunctionLikeReturnTypeHints: true,
});
| {
"end_byte": 227,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInferredTypePredicate1.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportAllowSyntheticDefaultImports4.ts_0_365 | /// <reference path="fourslash.ts" />
// @AllowSyntheticDefaultImports: false
// @Module: amd
// @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/importNameCodeFixNewImportAllowSyntheticDefaultImports4.ts"
} |
TypeScript/tests/cases/fourslash/referencesForIndexProperty.ts_0_303 | /// <reference path='fourslash.ts'/>
// References a class property using string index access
////class Foo {
//// /*1*/property: number;
//// /*2*/method(): void { }
////}
////
////var f: Foo;
////f["/*3*/property"];
////f["/*4*/method"];
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 303,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForIndexProperty.ts"
} |
TypeScript/tests/cases/fourslash/navigationItemsOverloads1.ts_0_1646 | /// <reference path="fourslash.ts"/>
////function overload(a: string): boolean;
////function overload(b: boolean): boolean;
////function overload(b: number): boolean;
////function overload(f: typeof overload): boolean;
////[|function overload(x: any, b = (function overload() { return false })): boolean {
//// throw overload;
////}|]
////
////interface I {
//// [|interfaceMethodSignature(a: string): boolean;|]
//// interfaceMethodSignature(b: boolean): boolean;
//// interfaceMethodSignature(b: number): boolean;
//// interfaceMethodSignature(f: I): boolean;
////}
////
////class C {
//// methodOverload(a: string): boolean;
//// methodOverload(b: boolean): boolean;
//// methodOverload(b: number): boolean;
//// methodOverload(f: I): boolean;
//// [|methodOverload(x: any, b = (function overload() { return false })): boolean {
//// throw C;
//// }|]
////}
const [r0, r1, r2] = test.ranges();
const methodOverload: FourSlashInterface.ExpectedNavigateToItem =
{ name: "methodOverload", kind: "method", range: r2, containerName: "C", containerKind: "class" };
verify.navigateTo(
{
pattern: "overload",
expected: [
{ name: "overload", kind: "function", range: r0 },
{ ...methodOverload, matchKind: "substring", isCaseSensitive: false },
]
},
{
pattern: "interfaceMethodSignature",
expected: [
{ name: "interfaceMethodSignature", kind: "method", range: r1, containerName: "I", containerKind: "interface" },
],
},
{
pattern: "methodOverload",
expected: [methodOverload],
},
);
| {
"end_byte": 1646,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationItemsOverloads1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingParam13.ts_0_517 | /// <reference path="fourslash.ts" />
////function f(a: string): string;
////function f(a: string, b: number): string;
////function f(a: string, b?: number): string {
//// return "";
////}
////f("", 1, "");
verify.codeFix({
description: [ts.Diagnostics.Add_missing_parameter_to_0.message, "f"],
index: 0,
newFileContent:
`function f(a: string): string;
function f(a: string, b: number, p0: string): string;
function f(a: string, b?: number, p0?: string): string {
return "";
}
f("", 1, "");`
});
| {
"end_byte": 517,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam13.ts"
} |
TypeScript/tests/cases/fourslash/autoImportsCustomConditions.ts_0_487 | /// <reference path="fourslash.ts" />
// @module: esnext
// @moduleResolution: bundler
// @customConditions: custom
// @Filename: /node_modules/dep/package.json
//// {
//// "name": "dep",
//// "version": "1.0.0",
//// "exports": {
//// ".": {
//// "custom": "./dist/index.js"
//// }
//// }
//// }
// @Filename: /node_modules/dep/dist/index.d.ts
//// export const dep: number;
// @Filename: /index.ts
//// dep/**/
verify.importFixModuleSpecifiers("", ["dep"]);
| {
"end_byte": 487,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportsCustomConditions.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsUnionProperty.ts_0_434 | /// <reference path='fourslash.ts'/>
////type T =
//// | { /*t0*/type: "a", /*p0*/prop: number }
//// | { /*t1*/type: "b", /*p1*/prop: string };
////const tt: T = {
//// /*t2*/type: "a",
//// /*p2*/prop: 0,
////};
////declare const t: T;
////if (t./*t3*/type === "a") {
//// t./*t4*/type;
////} else {
//// t./*t5*/type;
////}
verify.baselineFindAllReferences('t0', 't1', 't3', 't4', 't5', 't2', 'p0', 'p1', 'p2')
| {
"end_byte": 434,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsUnionProperty.ts"
} |
TypeScript/tests/cases/fourslash/completionListOfSplitInterface.ts_0_706 | /// <reference path="fourslash.ts"/>
////interface A {
//// a: number;
////}
////interface I extends A {
//// i1: number;
////}
////interface I1 extends A {
//// i11: number;
////}
////interface B {
//// b: number;
////}
////interface B1 {
//// b1: number;
////}
////interface I extends B {
//// i2: number;
////}
////interface I1 extends B, B1 {
//// i12: number;
////}
////interface C {
//// c: number;
////}
////interface I extends C {
//// i3: number;
////}
////var ci: I;
////ci./*1*/b;
////var ci1: I1;
////ci1./*2*/b;
verify.completions(
{ marker: "1", unsorted: ["i1", "i2", "i3", "a", "b", "c"] },
{ marker: "2", unsorted: ["i11", "i12", "a", "b", "b1"] },
);
| {
"end_byte": 706,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOfSplitInterface.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterface_04.ts_0_550 | /// <reference path='fourslash.ts'/>
// Should go to function literals that implement the interface within variable like declarations when invoked on an interface
//// interface Fo/*interface_definition*/o {
//// (a: number): void
//// }
////
//// var bar: Foo = [|(a) => {/**0*/}|];
////
//// function whatever(x: Foo = [|(a) => {/**1*/}|] ) {
//// }
////
//// class Bar {
//// x: Foo = [|(a) => {/**2*/}|]
////
//// constructor(public f: Foo = [|function(a) {}|] ) {}
//// }
verify.baselineGoToImplementation("interface_definition"); | {
"end_byte": 550,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_04.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM2.ts_0_444 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: types/dep.d.ts
//// export declare class Dep {}
// @Filename: index.js
//// Dep/**/
// @Filename: util1.ts
//// import fs from 'fs';
// @Filename: util2.js
//// const fs = require('fs');
// TypeScript files don't count as indicators of import style for JS
goTo.marker("");
verify.importFixAtPosition([`const { Dep } = require("./types/dep");
Dep`]); | {
"end_byte": 444,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsCJSvsESM2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts_0_503 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
// @Filename: /a.ts
////export class D {}
////export default new D();
// @Filename: /b.ts
////export class C {
//// [|set x(val) { val; }|]
//// method() { this.x = import("./a"); }
////}
goTo.file("/b.ts");
verify.codeFix({
index: 0,
description: "Infer type of 'x' from usage",
newFileContent:
`export class C {
set x(val: Promise<typeof import("./a")>) { val; }
method() { this.x = import("./a"); }
}`,
});
| {
"end_byte": 503,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageSetterWithInaccessibleType.ts"
} |
TypeScript/tests/cases/fourslash/importStatementCompletions2.ts_0_1052 | /// <reference path="fourslash.ts" />
// @Filename: /button.ts
//// export function Button() {}
// @Filename: /index1.ts
//// [|import Butt/*0*/|]
////
//// interface Props {}
//// const x = 0
// @Filename: /index2.ts
//// [|import { Butt/*1*/ }|]
////
//// interface Props {}
//// const x = 0
// @Filename: /index3.ts
//// [|import { Butt/*2*/|]
////
//// interface Props {}
//// const x = 0
[0, 1, 2].forEach(marker => {
verify.completions({
marker: `${marker}`,
isNewIdentifierLocation: true,
exact: [{
name: "Button",
source: "./button",
sourceDisplay: "./button",
insertText: `import { Button$1 } from "./button"`,
isSnippet: true,
replacementSpan: test.ranges()[marker],
}, {
name: "type",
sortText: completion.SortText.GlobalsOrKeywords,
}],
preferences: {
includeCompletionsForImportStatements: true,
includeCompletionsForModuleExports: true,
includeCompletionsWithSnippetText: true,
includeCompletionsWithInsertText: true,
},
});
});
| {
"end_byte": 1052,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importStatementCompletions2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUseBigIntLiteral2.ts_0_1964 | /// <reference path="fourslash.ts" />
////1000000000000000000000; // 1e21
////1_000_000_000_000_000_000_000; // 1e21
////0x3635C9ADC5DEA00000; // 1e21
////100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; // 1e320
////100_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000; // 1e320
verify.codeFixAll({
fixAllDescription: ts.Diagnostics.Convert_all_to_bigint_numeric_literals.message,
fixId: "useBigintLiteral",
newFileContent:
`1000000000000000000000n; // 1e21
1_000_000_000_000_000_000_000n; // 1e21
0x3635C9ADC5DEA00000n; // 1e21
100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n; // 1e320
100_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000n; // 1e320`,
});
| {
"end_byte": 1964,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUseBigIntLiteral2.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_jsx5.ts_0_726 | /// <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 React from "react";
////<[|Text|] />;
goTo.file("/a.tsx");
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_import_from_0.message, "react-native"],
newFileContent:
`import React from "react";
import { Text } from "react-native";
<Text />;`
});
| {
"end_byte": 726,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsx5.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoCommentsCommentParsing.ts_0_6139 | /// <reference path='fourslash.ts' />
/////// This is simple /// comments
////function simple() {
////}
////
////sim/*1q*/ple( );
////
/////// multiLine /// Comments
/////// This is example of multiline /// comments
/////// Another multiLine
////function multiLine() {
////}
////mul/*2q*/tiLine( );
////
/////** this is eg of single line jsdoc style comment */
////function jsDocSingleLine() {
////}
////jsDoc/*3q*/SingleLine();
////
////
/////** this is multiple line jsdoc stule comment
////*New line1
////*New Line2*/
////function jsDocMultiLine() {
////}
////jsDocM/*4q*/ultiLine();
////
/////** multiple line jsdoc comments no longer merge
////*New line1
////*New Line2*/
/////** Shoul mege this line as well
////* and this too*/ /** Another this one too*/
////function jsDocMultiLineMerge() {
////}
////jsDocMu/*5q*/ltiLineMerge();
////
////
/////// Triple slash comment
/////** jsdoc comment */
////function jsDocMixedComments1() {
////}
////jsDocMix/*6q*/edComments1();
////
/////// Triple slash comment
/////** jsdoc comment */ /** another jsDocComment*/
////function jsDocMixedComments2() {
////}
////jsDocMi/*7q*/xedComments2();
////
/////** jsdoc comment */ /*** triplestar jsDocComment*/
/////// Triple slash comment
////function jsDocMixedComments3() {
////}
////jsDocMixe/*8q*/dComments3();
////
/////** jsdoc comment */ /** another jsDocComment*/
/////// Triple slash comment
/////// Triple slash comment 2
////function jsDocMixedComments4() {
////}
////jsDocMixed/*9q*/Comments4();
////
/////// Triple slash comment 1
/////** jsdoc comment */ /** another jsDocComment*/
/////// Triple slash comment
/////// Triple slash comment 2
////function jsDocMixedComments5() {
////}
////jsDocM/*10q*/ixedComments5();
////
/////** another jsDocComment*/
/////// Triple slash comment 1
/////// Triple slash comment
/////// Triple slash comment 2
/////** jsdoc comment */
////function jsDocMixedComments6() {
////}
////jsDocMix/*11q*/edComments6();
////
////// This shoulnot be help comment
////function noHelpComment1() {
////}
////noHel/*12q*/pComment1();
////
/////* This shoulnot be help comment */
////function noHelpComment2() {
////}
////noHelpC/*13q*/omment2();
////
////function noHelpComment3() {
////}
////noHelpC/*14q*/omment3();
/////** Adds two integers and returns the result
//// * @param {number} a first number
//// * @param b second number
//// */
////function sum(/*16aq*/a: number, /*17aq*/b: number) {
//// return a + b;
////}
////s/*16q*/um(10, 20);
/////** This is multiplication function
//// * @param
//// * @param a first number
//// * @param b
//// * @param c {
//// @param d @anotherTag
//// * @param e LastParam @anotherTag*/
////function multiply(/*19aq*/a: number, /*20aq*/b: number, /*21aq*/c?: number, /*22aq*/d?, /*23aq*/e?) {
////}
////mult/*19q*/iply(10, 20, 30, 40, 50);
/////** fn f1 with number
////* @param { string} b about b
////*/
////function f1(/*25aq*/a: number);
////function f1(/*26aq*/b: string);
/////**@param opt optional parameter*/
////function f1(aOrb, opt?) {
//// return aOrb;
////}
////f/*25q*/1(10);
////f/*26q*/1("hello");
////
/////** This is subtract function
////@param { a
////*@param { number | } b this is about b
////@param { { () => string; } } c this is optional param c
////@param { { () => string; } d this is optional param d
////@param { { () => string; } } e this is optional param e
////@param { { { () => string; } } f this is optional param f
////*/
////function subtract(/*28aq*/a: number, /*29aq*/b: number, /*30aq*/c?: () => string, /*31aq*/d?: () => string, /*32aq*/e?: () => string, /*33aq*/f?: () => string) {
////}
////subt/*28q*/ract(10, 20, null, null, null, null);
/////** this is square function
////@paramTag { number } a this is input number of paramTag
////@param { number } a this is input number
////@returnType { number } it is return type
////*/
////function square(/*34aq*/a: number) {
//// return a * a;
////}
////squ/*34q*/are(10);
/////** this is divide function
////@param { number} a this is a
////@paramTag { number } g this is optional param g
////@param { number} b this is b
////*/
////function divide(/*35aq*/a: number, /*36aq*/b: number) {
////}
////div/*35q*/ide(10, 20);
/////**
////Function returns string concat of foo and bar
////@param {string} foo is string
////@param {string} bar is second string
////*/
////function fooBar(/*37aq*/foo: string, /*38aq*/bar: string) {
//// return foo + bar;
////}
////fo/*37q*/oBar("foo","bar");
/////** This is a comment */
////var x;
/////**
//// * This is a comment
//// */
////var y;
/////** this is jsdoc style function with param tag as well as inline parameter help
////*@param a it is first parameter
////*@param c it is third parameter
////*/
////function jsDocParamTest(/** this is inline comment for a *//*40aq*/a: number, /** this is inline comment for b*/ /*41aq*/b: number, /*42aq*/c: number, /*43aq*/d: number) {
//// return a + b + c + d;
////}
////jsD/*40q*/ocParamTest(30, 40, 50, 60);
/////** This is function comment
//// * And properly aligned comment
//// */
////function jsDocCommentAlignmentTest1() {
////}
////jsDocCom/*45q*/mentAlignmentTest1();
/////** This is function comment
//// * And aligned with 4 space char margin
//// */
////function jsDocCommentAlignmentTest2() {
////}
////jsDocComme/*46q*/ntAlignmentTest2();
/////** This is function comment
//// * And aligned with 4 space char margin
//// * @param {string} a this is info about a
//// * spanning on two lines and aligned perfectly
//// * @param b this is info about b
//// * spanning on two lines and aligned perfectly
//// * spanning one more line alined perfectly
//// * spanning another line with more margin
//// * @param c this is info about b
//// * not aligned text about parameter will eat only one space
//// */
////function jsDocCommentAlignmentTest3(/*47aq*/a: string, /*48aq*/b, /*49aq*/c) {
////}
////jsDocComme/*47q*/ntAlignmentTest3("hello",1, 2);
/////**/
////class NoQuic/*50q*/kInfoClass {
////}
verify.baselineQuickInfo()
| {
"end_byte": 6139,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoCommentsCommentParsing.ts"
} |
TypeScript/tests/cases/fourslash/explainFilesNodeNextWithTypesReference.ts_0_1282 | /// <reference path="fourslash.ts" />
// @Filename: /node_modules/react-hook-form/package.json
//// {
//// "name": "react-hook-form",
//// "main": "dist/index.cjs.js",
//// "module": "dist/index.esm.js",
//// "types": "dist/index.d.ts",
//// "exports": {
//// "./package.json": "./package.json",
//// ".": {
//// "import": "./dist/index.esm.js",
//// "require": "./dist/index.cjs.js",
//// "types": "./dist/index.d.ts"
//// }
//// }
//// }
// @Filename: /node_modules/react-hook-form/dist/index.cjs.js
//// module.exports = {};
// @Filename: /node_modules/react-hook-form/dist/index.esm.js
//// export function useForm() {}
// @Filename: /node_modules/react-hook-form/dist/index.d.ts
//// /// <reference types="react/**/" />
//// export type Foo = React.Whatever;
//// export function useForm(): any;
// @Filename: /node_modules/react/index.d.ts
//// declare namespace JSX {}
//// declare namespace React { export interface Whatever {} }
// @Filename: /tsconfig.json
//// {
//// "compilerOptions": {
//// "module": "nodenext",
//// "explainFiles": true
//// }
//// "files": ["./index.ts"]
//// }
// @Filename: /index.ts
//// import { useForm } from "react-hook-form";
verify.baselineFindAllReferences(""); | {
"end_byte": 1282,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/explainFilesNodeNextWithTypesReference.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixExistingImport2.ts_0_355 | /// <reference path="fourslash.ts" />
////import * as ns from "./module";
////// Comment
////f1/*0*/();
// @Filename: module.ts
//// export function f1() {}
//// export var v1 = 5;
verify.importFixAtPosition([
`import * as ns from "./module";
// Comment
ns.f1();`,
`import * as ns from "./module";
import { f1 } from "./module";
// Comment
f1();`,
]);
| {
"end_byte": 355,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixExistingImport2.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash17.ts_0_193 | /// <reference path="fourslash.ts"/>
//// /// <summary>Text</summary>
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("/// <summary>Text</summary>"));
| {
"end_byte": 193,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash17.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsagePropertyDeclarationArrowFunction.ts_0_958 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
// @Filename: test.ts
////class MyClass {
//// bar = (a, b, c, d, e, f) => {};
////};
////
////interface I {
//// x: number;
////}
////
////enum E {
//// X
////}
////
////function foo(x: MyClass) {
//// const a = 1;
//// const b = "";
//// const c = { x: 1, y: 1 };
//// const d = [1, 2, 3];
//// const e: I = { x: 1 };
//// const f: E = E.X;
//// x.bar(a, b, c, d, e, f);
////}
verify.codeFixAll({
fixId: "inferFromUsage",
fixAllDescription: "Infer all types from usage",
newFileContent:
`class MyClass {
bar = (a: number, b: string, c: { x: number; y: number; }, d: number[], e: I, f: E) => {};
};
interface I {
x: number;
}
enum E {
X
}
function foo(x: MyClass) {
const a = 1;
const b = "";
const c = { x: 1, y: 1 };
const d = [1, 2, 3];
const e: I = { x: 1 };
const f: E = E.X;
x.bar(a, b, c, d, e, f);
}`,
});
| {
"end_byte": 958,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsagePropertyDeclarationArrowFunction.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration15.ts_0_474 | /// <reference path='fourslash.ts' />
// @filename: /test.ts
////export const x = 1;
// @filename: /foo.ts
////import * as test from "./test";
////test.foo<string, number>();
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<T, U>() {
throw new Error("Function not implemented.");
}
`
}
});
| {
"end_byte": 474,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration15.ts"
} |
TypeScript/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts_0_359 | /// <reference path="fourslash.ts" />
//// class foo { };
//// function foo() { /**/ }
goTo.marker();
// Function with bodies can only merge with classes
// Class declaration cannot implement overload list
verify.numberOfErrorsInCurrentFile(2);
// Shouldn't change the number of errors
edit.insert('return null;');
verify.numberOfErrorsInCurrentFile(2);
| {
"end_byte": 359,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/insertReturnStatementInDuplicateIdentifierFunction.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespace9.ts_0_271 | /// <reference path='fourslash.ts' />
/////*a*/import { join } from "path";
////i/*b*/mport * as fs from "fs";
////
////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_namedToNamespace9.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateConsecutiveStr.ts_0_456 | /// <reference path='fourslash.ts' />
//// const foo = "/*x*/f/*y*/oobar is " + 42 + " years" + " old" + " and " + 6 + " cars" + " are" + " missing"
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent:
`const foo = \`foobar is \${42} years old and \${6} cars are missing\``,
});
| {
"end_byte": 456,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateConsecutiveStr.ts"
} |
TypeScript/tests/cases/fourslash/getEditsForFileRename_renameToIndex.ts_0_926 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
/////// <reference path="./src/old.ts" />
////import old from "./src/old";
// @Filename: /src/a.ts
/////// <reference path="./old.ts" />
////import old from "./old";
// @Filename: /src/foo/a.ts
/////// <reference path="../old.ts" />
////import old from "../old";
// @Filename: /src/old.ts
////
// @Filename: /tsconfig.json
////{ "files": ["a.ts", "src/a.ts", "src/foo/a.ts", "src/old.ts"] }
verify.getEditsForFileRename({
oldPath: "/src/old.ts",
newPath: "/src/index.ts",
newFileContents: {
"/a.ts":
`/// <reference path="./src/index.ts" />
import old from "./src";`,
"/src/a.ts":
`/// <reference path="./index.ts" />
import old from ".";`,
"/src/foo/a.ts":
`/// <reference path="../index.ts" />
import old from "..";`,
"/tsconfig.json":
'{ "files": ["a.ts", "src/a.ts", "src/foo/a.ts", "src/index.ts"] }',
},
});
| {
"end_byte": 926,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getEditsForFileRename_renameToIndex.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThrow6.ts_0_294 | /// <reference path='fourslash.ts' />
////[|throw|] 100;
////
////try {
//// throw 0;
//// var x = () => { throw 0; };
////}
////catch (y) {
//// var x = () => { throw 0; };
//// [|throw|] 200;
////}
////finally {
//// [|throw|] 300;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 294,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThrow6.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue_all3.ts_0_2017 | /// <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: "fixWrapTheBlockWithParen",
fixAllDescription: "Wrap all object literal with parentheses",
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": 2017,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue_all3.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.