_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/organizeImportsType2.ts_0_907 | /// <reference path='fourslash.ts' />
// @allowSyntheticDefaultImports: true
// @moduleResolution: node
// @noUnusedLocals: true
// @target: es2018
//// type A = string;
//// type B = string;
//// const C = "hello";
//// export { A, type B, C };
// default behavior is equivalent to "last"
verify.organizeImports(
`type A = string;
type B = string;
const C = "hello";
export { A, C, type B };
`
);
verify.organizeImports(
`type A = string;
type B = string;
const C = "hello";
export { A, type B, C };
`,
undefined,
{ organizeImportsTypeOrder : "inline" }
);
verify.organizeImports(
`type A = string;
type B = string;
const C = "hello";
export { type B, A, C };
`,
undefined,
{ organizeImportsTypeOrder : "first" }
);
verify.organizeImports(
`type A = string;
type B = string;
const C = "hello";
export { A, C, type B };
`,
undefined,
{ organizeImportsTypeOrder : "last" }
); | {
"end_byte": 907,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsType2.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_promoteTypeOnly2.ts_0_360 | /// <reference path="fourslash.ts" />
// @module: es2015
// @Filename: /exports.ts
//// export interface SomeInterface {}
// @Filename: /a.ts
//// import type { SomeInterface } from "./exports.js";
//// const SomeInterface = {};
//// SomeI/**/
// Should NOT promote this
verify.completions({
marker: "",
includes: [{
name: "SomeInterface"
}]
});
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_promoteTypeOnly2.ts"
} |
TypeScript/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts_0_181 | /// <reference path="fourslash.ts" />
// @module: CommonJS
//// interface privateInterface {}
//// export class Bar implements /*1*/privateInterface/*2*/{ }
verify.noErrors();
| {
"end_byte": 181,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getSemanticDiagnosticForNoDeclaration.ts"
} |
TypeScript/tests/cases/fourslash/unusedTypeParametersInLambda2.ts_0_288 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
//// var x : {
//// [|new <T, U>(a: T): void;|]
//// }
verify.codeFix({
description: "Remove unused declaration for: 'U'",
index: 0,
newRangeContent: "new <T>(a: T): void;",
});
| {
"end_byte": 288,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedTypeParametersInLambda2.ts"
} |
TypeScript/tests/cases/fourslash/augmentedTypesClass3Fourslash.ts_0_339 | /// <reference path='fourslash.ts'/>
////class c/*1*/5b { public foo() { } }
////namespace c/*2*/5b { export var y = 2; } // should be ok
/////*3*/
verify.quickInfos({
1: "class c5b\nnamespace c5b",
2: "class c5b\nnamespace c5b"
});
verify.completions({ marker: "3", includes: { name: "c5b", text: "class c5b\nnamespace c5b" }})
| {
"end_byte": 339,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/augmentedTypesClass3Fourslash.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnThis5.ts_0_534 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
////const foo = {
//// num: 0,
//// f() {
//// type Y = typeof th/*1*/is;
//// type Z = typeof th/*2*/is.num;
//// },
//// g(this: number) {
//// type X = typeof th/*3*/is;
//// }
////}
////class Foo {
//// num = 0;
//// f() {
//// type Y = typeof th/*4*/is;
//// type Z = typeof th/*5*/is.num;
//// }
//// g(this: number) {
//// type X = typeof th/*6*/is;
//// }
////}
verify.baselineQuickInfo();
| {
"end_byte": 534,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnThis5.ts"
} |
TypeScript/tests/cases/fourslash/renameJsThisProperty03.ts_0_300 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: a.js
////class C {
//// constructor(y) {
//// [|this.[|{| "contextRangeIndex": 0 |}x|] = y;|]
//// }
////}
////var t = new C(12);
////[|t.[|{| "contextRangeIndex": 2 |}x|] = 11;|]
verify.baselineRenameAtRangesWithText("x");
| {
"end_byte": 300,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsThisProperty03.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport10.ts_0_518 | /// <reference path="fourslash.ts" />
// @verbatimModuleSyntax: true
// @module: esnext
// @moduleResolution: bundler
// @target: esnext
// @filename: /a.ts
////function f() {}
////export interface I {}
////export type { f };
// @Filename: /b.ts
////import { I, f } from "./a";
////export { type I, f };
goTo.file("/b.ts");
verify.codeFixAvailable([
{ description: "Use 'import type'" },
{ description: "Use 'type I'" },
{ description: "Use 'import type'" },
{ description: "Use 'type f'" },
]);
| {
"end_byte": 518,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport10.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration23.ts_0_485 | /// <reference path="fourslash.ts" />
// @jsx: preserve
// @filename: foo.tsx
////const A = () => {
//// return (<div onClick={() => handleClick()}></div>);
////}
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "handleClick"],
newFileContent:
`const A = () => {
function handleClick() {
throw new Error("Function not implemented.");
}
return (<div onClick={() => handleClick()}></div>);
}`
});
| {
"end_byte": 485,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration23.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_parameter4.ts_0_411 | /// <reference path="fourslash.ts" />
// @noUnusedLocals: true
// @noUnusedParameters: true
////[|function f(
//// a: number, b: number, /* comment related to c */
//// c: number,
////)|] {
//// a;
//// c;
////}
verify.codeFix({
index: 0,
description: "Remove unused declaration for: 'b'",
newRangeContent:
`function f(
a: number, /* comment related to c */
c: number,
)`
});
| {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_parameter4.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectLiteral2.ts_0_1176 | /// <reference path='fourslash.ts'/>
////interface TelemetryService {
//// publicLog(eventName: string, data: any): any;
////};
////class SearchResult {
//// count() { return 5; }
//// isEmpty() { return true; }
//// fileCount(): string { return ""; }
////}
////class Foo {
//// public telemetryService: TelemetryService; // If telemetry service is of type 'any' (i.e. uncomment below line), the drop-down list works
//// public telemetryService2;
//// private test() {
//// var onComplete = (searchResult: SearchResult) => {
//// var hasResults = !searchResult.isEmpty(); // Drop-down list on searchResult fine here
//// // No drop-down list available on searchResult members within object literal below
//// this.telemetryService.publicLog('searchResultsShown', { count: searchResult./*1*/count(), fileCount: searchResult.fileCount() });
//// this.telemetryService2.publicLog('searchResultsShown', { count: searchResult./*2*/count(), fileCount: searchResult.fileCount() });
//// };
//// }
////}
verify.completions({ marker: test.markers(), exact: ["count", "fileCount", "isEmpty"] });
| {
"end_byte": 1176,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectLiteral2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAwaitInSyncFunction12.ts_0_359 | /// <reference path='fourslash.ts' />
////const f: () => Array<number | string> = function() {
//// await Promise.resolve([]);
////}
verify.codeFix({
index: 1,
description: "Add async modifier to containing function",
newFileContent:
`const f: () => Promise<Array<number | string>> = async function() {
await Promise.resolve([]);
}`,
});
| {
"end_byte": 359,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAwaitInSyncFunction12.ts"
} |
TypeScript/tests/cases/fourslash/completionListInObjectBindingPattern16.ts_0_320 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @filename: a.js
/////**
//// * @typedef Foo
//// * @property {number} a
//// * @property {string} b
//// */
////
/////**
//// * @param {Foo} options
//// */
////function f({ /**/ }) {}
verify.completions({ marker: "", exact: ["a", "b"] });
| {
"end_byte": 320,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInObjectBindingPattern16.ts"
} |
TypeScript/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard3.ts_0_1054 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /node_modules/foo/package.json
//// {
//// "types": "index.d.ts",
//// "exports": {
//// "./component-*": {
//// "types@>=4.3.5": "types/components/*.d.ts"
//// }
//// }
//// }
// @Filename: /node_modules/foo/nope.d.ts
//// export const nope = 0;
// @Filename: /node_modules/foo/types/components/index.d.ts
//// export const index = 0;
// @Filename: /node_modules/foo/types/components/blah.d.ts
//// export const blah = 0;
// @Filename: /node_modules/foo/types/components/subfolder/one.d.ts
//// export const one = 0;
// @Filename: /a.ts
//// import { } from "foo//**/";
verify.completions({
marker: "",
isNewIdentifierLocation: true,
exact: [
{ name: "component-blah", kind: "script" },
{ name: "component-index", kind: "script" },
{ name: "component-subfolder", kind: "directory" },
],
});
edit.insert("component-subfolder/");
verify.completions({
isNewIdentifierLocation: true,
exact: [{ name: "one", kind: "script" }],
});
| {
"end_byte": 1054,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/pathCompletionsPackageJsonExportsWildcard3.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsOnImportAliases2.ts_0_733 | /// <reference path="fourslash.ts" />
//@Filename: a.ts
////[|export class /*class0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Class|] {}|]
//@Filename: b.ts
////[|import { /*class1*/[|{| "contextRangeIndex": 2 |}Class|] as /*c2_0*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}C2|] } from "./a";|]
////var c = new /*c2_1*/[|C2|]();
//@Filename: c.ts
////[|export { /*class2*/[|{| "contextRangeIndex": 6 |}Class|] as /*c3*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}C3|] } from "./a";|]
verify.baselineFindAllReferences('class0', 'class1', 'class2', 'c2_0', 'c2_1', 'c3');
verify.baselineRenameAtRangesWithText(["Class", "C2", "C3"]);
| {
"end_byte": 733,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsOnImportAliases2.ts"
} |
TypeScript/tests/cases/fourslash/organizeImportsReactJsx.ts_0_787 | /// <reference path='fourslash.ts' />
// @allowSyntheticDefaultImports: true
// @moduleResolution: node
// @noUnusedLocals: true
// @target: es2018
// @jsx: react-jsx
// @filename: test.tsx
////import React from 'react';
////export default () => <div></div>
// @filename: node_modules/react/package.json
////{
//// "name": "react",
//// "types": "index.d.ts",
////}
// @filename: node_modules/react/index.d.ts
////export = React;
////declare namespace JSX {
//// interface IntrinsicElements { [x: string]: any; }
////}
////declare namespace React {}
// @filename: node_modules/react/jsx-runtime.d.ts
////import './';
// @filename: node_modules/react/jsx-dev-runtime.d.ts
////import './';
goTo.file("test.tsx");
verify.organizeImports(`export default () => <div></div>`);
| {
"end_byte": 787,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImportsReactJsx.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprInEnding.ts_0_361 | /// <reference path='fourslash.ts' />
//// const foo = "/*x*/f/*y*/oobar is " + (42 + 6)
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert to template string",
actionName: "Convert to template string",
actionDescription: ts.Diagnostics.Convert_to_template_string.message,
newContent:
"const foo = `foobar is \${42 + 6}`",
});
| {
"end_byte": 361,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateBinaryExprInEnding.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties12.ts_0_295 | /// <reference path='fourslash.ts' />
////interface Foo {
//// a: number;
//// b: number;
////}
////function f(foo: Foo) {}
////[|f({})|];
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`f({
a: 0,
b: 0
})`
});
| {
"end_byte": 295,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties12.ts"
} |
TypeScript/tests/cases/fourslash/completionListOnParamOfGenericType1.ts_0_410 | /// <reference path='fourslash.ts'/>
////export class List<T> {
//// public next: List<T>;
//// public prev: List<T>;
//// public pushEntry(entry: List<T>): void {
//// entry./*1*/
//// }
////}
const exact = ["next", "prev", "pushEntry"];
verify.completions({ marker: "1", exact });
edit.insert('next.');
verify.completions({ exact });
edit.insert('prev.');
verify.completions({ exact });
| {
"end_byte": 410,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListOnParamOfGenericType1.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts_0_411 | /// <reference path='fourslash.ts'/>
////class C<T> {
//// map(fn: (/*1*/k: string, /*2*/value: T, context: any) => void, context: any) {
//// }
////}
////var c: C<number>;
////c.map(/*3*/
verify.quickInfos({
1: "(parameter) k: string",
2: "(parameter) value: T"
});
verify.signatureHelp({ marker: "3", text: "map(fn: (k: string, value: number, context: any) => void, context: any): void" });
| {
"end_byte": 411,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInFunctionTypeReference2.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts_0_425 | /// <reference path='fourslash.ts'/>
////interface I {
//// /*0*/property1: number;
//// property2: string;
////}
////
////var elems: I[];
////for (let { /*1*/property1: p } of elems) {
////}
////for (let { /*2*/property1 } of elems) {
////}
////for (var { /*3*/property1: p1 } of elems) {
////}
////var p2;
////for ({ /*4*/property1 : p2 } of elems) {
////}
verify.baselineFindAllReferences('0', '1', '3', '4', '2')
| {
"end_byte": 425,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName06.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_blankExistingFile.ts_0_480 | /// <reference path='fourslash.ts' />
// @Filename: /bar.ts
//////
// @Filename: /a.ts
////import { b } from './other';
////const p = 0;
////[|const y: Date = p + b;|]
// @Filename: /other.ts
////export const b = 1;
verify.moveToFile({
newFileContents: {
"/a.ts":
`export const p = 0;
`,
"/bar.ts":
`//
import { p } from './a';
import { b } from './other';
const y: Date = p + b;
`,
},
interactiveRefactorArguments: {targetFile: "/bar.ts"},
});
| {
"end_byte": 480,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_blankExistingFile.ts"
} |
TypeScript/tests/cases/fourslash/autoImportSymlinkCaseSensitive.ts_0_635 | /// <reference path="fourslash.ts" />
// @Filename: /tsconfig.json
//// { "compilerOptions": { "module": "commonjs" } }
// @Filename: /node_modules/.pnpm/mobx@6.0.4/node_modules/MobX/Foo.d.ts
//// export declare function autorun(): void;
// @Filename: /index.ts
//// autorun/**/
// @Filename: /utils.ts
//// import "MobX/Foo";
// @link: /node_modules/.pnpm/mobx@6.0.4/node_modules/MobX -> /node_modules/MobX
// @link: /node_modules/.pnpm/mobx@6.0.4/node_modules/MobX -> /node_modules/.pnpm/cool-mobx-dependent@1.2.3/node_modules/MobX
goTo.marker("");
verify.importFixAtPosition([`import { autorun } from "MobX/Foo";
autorun`]);
| {
"end_byte": 635,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportSymlinkCaseSensitive.ts"
} |
TypeScript/tests/cases/fourslash/completionsObjectLiteralExpressions6.ts_2_989 | /// <reference path="fourslash.ts" />
//// type E = {}
//// type F = string
//// const i= { e: {} };
//// interface I { e: E, f?: F }
//// const k: I = {
//// ["e"]: i
//// /**/
//// }
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
const i= { e: {} };
interface I { e: E, f?: F }
const k: I = {
["e"]: i,
}`,
preferences: {
allowIncompleteCompletions: true,
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 989,
"start_byte": 2,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsObjectLiteralExpressions6.ts"
} |
TypeScript/tests/cases/fourslash/autoImportSpecifierExcludeRegexes2.ts_0_865 | /// <reference path="fourslash.ts" />
// @Filename: /tsconfig.json
//// {
//// "compilerOptions": {
//// "module": "preserve",
//// "paths": {
//// "@app/*": ["./src/*"]
//// }
//// }
//// }
// @Filename: /src/utils.ts
//// export function add(a: number, b: number) {}
// @Filename: /src/index.ts
//// add/**/
verify.importFixModuleSpecifiers("", ["./utils"]);
verify.importFixModuleSpecifiers("", ["@app/utils"], { autoImportSpecifierExcludeRegexes: ["^\\./"] });
verify.importFixModuleSpecifiers("", ["@app/utils"], { importModuleSpecifierPreference: "non-relative" });
verify.importFixModuleSpecifiers("", ["./utils"], { importModuleSpecifierPreference: "non-relative", autoImportSpecifierExcludeRegexes: ["^@app/"] });
verify.importFixModuleSpecifiers("", [], { autoImportSpecifierExcludeRegexes: ["utils"] });
| {
"end_byte": 865,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportSpecifierExcludeRegexes2.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_importEquals.ts_0_319 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////import i = require("./i");
////import j = require("./j");
////[|const y = i;|]
////j;
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`import j = require("./j");
j;`,
"/y.ts":
`import i = require("./i");
const y = i;
`,
},
});
| {
"end_byte": 319,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_importEquals.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPatternDefaultValues.ts_0_3643 | /// <reference path='fourslash.ts' />
////declare var console: {
//// log(msg: any): void;
////}
////type Robot = [number, string, string];
////type MultiSkilledRobot = [string, string[]];
////let robotA: Robot = [1, "mower", "mowing"];
////function getRobot() {
//// return robotA;
////}
////let multiRobotA: MultiSkilledRobot = ["mower", ["mowing", ""]];
////let multiRobotB: MultiSkilledRobot = ["trimmer", ["trimming", "edging"]];
////function getMultiRobot() {
//// return multiRobotA;
////}
////for (let [, nameA ="name"] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, nameA = "name"] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, nameA = "name"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["none", "none"]] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["none", "none"]] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for (let [, [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
////] = ["none", "none"]] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(primarySkillA);
////}
////for (let [numberB = -1] = robotA, i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [numberB = -1] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [numberB = -1] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberB);
////}
////for (let [nameB = "name"] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for (let [nameB = "name"] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for (let [nameB = "name"] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameB);
////}
////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = robotA, i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = getRobot(), i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let [numberA2 = -1, nameA2 = "name", skillA2 = "skill"] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(nameA2);
////}
////for (let
//// [nameMA = "noName",
//// [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
//// ] = ["none", "none"]
//// ] = multiRobotA, i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for (let [nameMA = "noName",
//// [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
//// ] = ["none", "none"]
////] = getMultiRobot(), i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for (let [nameMA = "noName",
//// [
//// primarySkillA = "primary",
//// secondarySkillA = "secondary"
//// ] = ["none", "none"]
////] = ["trimmer", ["trimming", "edging"]], i = 0; i < 1; i++) {
//// console.log(nameMA);
////}
////for (let [numberA3 = -1, ...robotAInfo] = robotA, i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for (let [numberA3 = -1, ...robotAInfo] = getRobot(), i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
////for (let [numberA3 = -1, ...robotAInfo] = [2, "trimmer", "trimming"], i = 0; i < 1; i++) {
//// console.log(numberA3);
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 3643,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringForArrayBindingPatternDefaultValues.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithOptionalPropertiesGenericValidBoolean.ts_0_395 | /// <reference path="fourslash.ts" />
// @strict: true
//// interface MyOptions {
//// hello?: boolean;
//// world?: boolean;
//// }
//// declare function bar<T extends MyOptions>(options?: Partial<T>): void;
//// bar({ hello: true, /*1*/ });
verify.completions({
marker: '1',
includes: [
{
sortText: completion.SortText.OptionalMember,
name: 'world'
},
]
})
| {
"end_byte": 395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOptionalPropertiesGenericValidBoolean.ts"
} |
TypeScript/tests/cases/fourslash/memberListInWithBlock3.ts_0_127 | /// <reference path='fourslash.ts'/>
////var x = { a: 0 };
////with(x./*1*/
verify.completions({ marker: "1", exact: "a" });
| {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberListInWithBlock3.ts"
} |
TypeScript/tests/cases/fourslash/completionInNamedImportLocation.ts_0_2157 | /// <reference path='fourslash.ts'/>
// @Filename: file.ts
////export var x = 10;
////export var y = 10;
////export { x as await, x as interface, x as unique };
////export default class C {
////}
// @Filename: a.ts
////import { /*1*/ } from "./file";
////import { x, /*2*/ } from "./file";
////import { x, y, /*3*/ } from "./file";
////import { x, y, await as await_, /*4*/ } from "./file";
////import { x, y, await as await_, interface as interface_, /*5*/ } from "./file";
////import { x, y, await as await_, interface as interface_, unique, /*6*/ } from "./file";
goTo.file("a.ts");
verify.completions(
{
marker: "1",
exact: [
{ name: "await", insertText: "await as await_" },
{ name: "interface", insertText: "interface as interface_" },
{ name: "unique" },
{ name: "x", text: "var x: number" },
{ name: "y", text: "var y: number" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords },
]
},
{
marker: "2",
exact: [
{ name: "await", insertText: "await as await_" },
{ name: "interface", insertText: "interface as interface_" },
{ name: "unique" },
{ name: "y", text: "var y: number" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords },
]
},
{
marker: "3",
exact: [
{ name: "await", insertText: "await as await_" },
{ name: "interface", insertText: "interface as interface_" },
{ name: "unique" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords },
]
},
{
marker: "4",
exact: [
{ name: "interface", insertText: "interface as interface_" },
{ name: "unique" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords },
]
},
{
marker: "5",
exact: [
{ name: "unique" },
{ name: "type", sortText: completion.SortText.GlobalsOrKeywords },
]
},
{
marker: "6",
exact: []
},
);
| {
"end_byte": 2157,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionInNamedImportLocation.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts_0_548 | /// <reference path='fourslash.ts'/>
// Should not return super implementations when method is implemented in class
//// interface Foo {
//// hello (): void;
//// }
////
//// class Bar extends SuperBar {
//// [|hello|]() {}
//// }
////
//// class SuperBar implements Foo {
//// hello() {} // should not show up
//// }
////
//// class OtherBar implements Foo {
//// hello() {} // should not show up
//// }
////
//// new Bar().hel/*function_call*/lo();
//// new Bar()["hello"]();
verify.baselineGoToImplementation("function_call"); | {
"end_byte": 548,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterfaceMethod_03.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoGenericCombinators2.ts_0_3830 | /// <reference path='fourslash.ts'/>
////interface Collection<T, U> {
//// length: number;
//// add(x: T, y: U): void ;
//// remove(x: T, y: U): boolean;
////}
////
////interface Combinators {
//// map<T, U, V>(c: Collection<T, U>, f: (x: T, y: U) => V): Collection<T, V>;
//// map<T, U>(c: Collection<T, U>, f: (x: T, y: U) => any): Collection<any, any>;
////}
////
////class A {
//// foo<T>(): T { return null; }
////}
////
////class B<T> {
//// foo(x: T): T { return null; }
////}
////
////var c1: Collection<any, any>;
////var c2: Collection<number, string>;
////var c3: Collection<Collection<number, number>, string>;
////var c4: Collection<number, A>;
////var c5: Collection<number, B<any>>;
////
////var _: Combinators;
////// param help on open paren for arg 2 should show 'number' not T or 'any'
////// x should be contextually typed to number
////var rf1 = (x: number, y: string) => { return x.toFixed() };
////var rf2 = (x: Collection<number, number>, y: string) => { return x.length };
////var rf3 = (x: number, y: A) => { return y.foo() };
////
////var /*9*/r1a = _.map/*1c*/(c2, (/*1a*/x, /*1b*/y) => { return x.toFixed() });
////var /*10*/r1b = _.map(c2, rf1);
////
////var /*11*/r2a = _.map(c3, (/*2a*/x, /*2b*/y) => { return x.length });
////var /*12*/r2b = _.map(c3, rf2);
////
////var /*13*/r3a = _.map(c4, (/*3a*/x, /*3b*/y) => { return y.foo() });
////var /*14*/r3b = _.map(c4, rf3);
////
////var /*15*/r4a = _.map(c5, (/*4a*/x, /*4b*/y) => { return y.foo() });
////
////var /*17*/r5a = _.map<number, string, Date>(c2, /*17error1*/(/*5a*/x, /*5b*/y) => { return x.toFixed() }/*17error2*/);
////var rf1b = (x: number, y: string) => { return new Date() };
////var /*18*/r5b = _.map<number, string, Date>(c2, rf1b);
////
////var /*19*/r6a = _.map<Collection<number, number>, string, Date>(c3, (/*6a*/x,/*6b*/y) => { return new Date(); });
////var rf2b = (x: Collection<number, number>, y: string) => { return new Date(); };
////var /*20*/r6b = _.map<Collection<number, number>, string, Date>(c3, rf2b);
////
////var /*21*/r7a = _.map<number, A, string>(c4, (/*7a*/x,/*7b*/y) => { return y.foo() });
////var /*22*/r7b = _.map<number, A, string>(c4, /*22error1*/rf3/*22error2*/);
////
////var /*23*/r8a = _.map<number, /*error1*/B/*error2*/, string>(c5, (/*8a*/x,/*8b*/y) => { return y.foo() });
verify.quickInfos({
"2a": "(parameter) x: Collection<number, number>",
"2b": "(parameter) y: string",
"3a": "(parameter) x: number",
"3b": "(parameter) y: A",
"4a": "(parameter) x: number",
"4b": "(parameter) y: B<any>",
"5a": "(parameter) x: number",
"5b": "(parameter) y: string",
"6a": "(parameter) x: Collection<number, number>",
"6b": "(parameter) y: string",
"7a": "(parameter) x: number",
"7b": "(parameter) y: A",
"8a": "(parameter) x: number",
"8b": "(parameter) y: any", // Specialized to any because no type argument was specified
9: "var r1a: Collection<number, string>",
10: "var r1b: Collection<number, string>",
11: "var r2a: Collection<Collection<number, number>, number>",
12: "var r2b: Collection<Collection<number, number>, number>",
13: "var r3a: Collection<number, unknown>",
14: "var r3b: Collection<number, unknown>",
15: "var r4a: Collection<number, any>",
17: "var r5a: Collection<number, Date>",
18: "var r5b: Collection<number, Date>",
19: "var r6a: Collection<Collection<number, number>, Date>",
20: "var r6b: Collection<Collection<number, number>, Date>",
21: "var r7a: Collection<number, string>",
22: "var r7b: Collection<number, string>",
23: "var r8a: Collection<number, string>"
});
verify.errorExistsBetweenMarkers('error1', 'error2');
verify.errorExistsBetweenMarkers('17error1', '17error2');
verify.errorExistsBetweenMarkers('22error1', '22error2'); | {
"end_byte": 3830,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoGenericCombinators2.ts"
} |
TypeScript/tests/cases/fourslash/formattingSpacesAfterConstructor.ts_0_422 | /// <reference path="fourslash.ts" />
/////*1*/class test { constructor () { } }
format.document();
goTo.marker("1");
verify.currentLineContentIs("class test { constructor() { } }");
/////*2*/class test { constructor () { } }
format.setOption("InsertSpaceAfterConstructor", true);
format.document();
goTo.marker("2");
verify.currentLineContentIs("class test { constructor () { } }"); | {
"end_byte": 422,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingSpacesAfterConstructor.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_prologueDirectives6.ts_0_539 | /// <reference path='fourslash.ts' />
// @module: esnext
// @Filename: /foo.ts
////export default function () {}
// @Filename: /a.ts
////"use strict";
////"use foo";
////"use bar";
////import foo from "./foo";
////[|function b() {
//// return foo;
////}|]
////b();
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`"use strict";
"use foo";
"use bar";
import { b } from "./b";
b();`,
"/b.ts":
`"use strict";
"use foo";
"use bar";
import foo from "./foo";
export function b() {
return foo;
}
`,
},
});
| {
"end_byte": 539,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_prologueDirectives6.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts_0_503 | /// <reference path='fourslash.ts' />
//// function f(templateStrings, x, y, z) { return 10; }
//// function g(templateStrings, x, y, z) { return ""; }
////
//// f ` ${ 123 } /*1*/${ } /*2*/\/*3*/
//// /*4*/\\/*5*/
//// /*6*/\\\/*7*/
//// /*8*/
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": 503,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpTaggedTemplatesIncomplete7.ts"
} |
TypeScript/tests/cases/fourslash/whiteSpaceTrimming2.ts_0_574 | /// <reference path="fourslash.ts" />
////let noSubTemplate = `/* /*1*/`;
////let templateHead = `/* /*2*/${1 + 2}`;
////let templateMiddle = `/* ${1 + 2 /*3*/}`;
////let templateTail = `/* ${1 + 2} /*4*/`;
goTo.marker('1');
edit.insert("\n");
goTo.marker('2');
edit.insert("\n");
goTo.marker('3');
edit.insert("\n");
goTo.marker('4');
edit.insert("\n");
verify.currentFileContentIs("let noSubTemplate = `/* \n`;\nlet templateHead = `/* \n${1 + 2}`;\nlet templateMiddle = `/* ${1 + 2\n }`;\nlet templateTail = `/* ${1 + 2} \n`;");
| {
"end_byte": 574,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/whiteSpaceTrimming2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConstructorForDerivedNeedSuperCall.ts_0_291 | /// <reference path='fourslash.ts' />
////class Base{
////}
////class C extends Base{
//// constructor() {}
////}
verify.codeFix({
description: "Add missing 'super()' call",
newFileContent:
`class Base{
}
class C extends Base{
constructor() {
super();
}
}`,
});
| {
"end_byte": 291,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConstructorForDerivedNeedSuperCall.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts_0_722 | /// <reference path="fourslash.ts"/>
//// /// <reference path="./module1.ts" />
//// /// <reference path="./module2.ts" />
const c = classification("original");
verify.syntacticClassificationsAre(
c.comment("/// "),
c.punctuation("<"),
c.jsxSelfClosingTagName("reference"),
c.comment(" "),
c.jsxAttribute("path"),
c.operator("="),
c.jsxAttributeStringLiteralValue("\"./module1.ts\""),
c.comment(" "),
c.punctuation("/>"),
c.comment("/// "),
c.punctuation("<"),
c.jsxSelfClosingTagName("reference"),
c.comment(" "),
c.jsxAttribute("path"),
c.operator("="),
c.jsxAttributeStringLiteralValue("\"./module2.ts\""),
c.comment(" "),
c.punctuation("/>"));
| {
"end_byte": 722,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsTripleSlash15.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration17.ts_0_297 | /// <reference path='fourslash.ts' />
////// comment
////foo();
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"],
newFileContent:
`// comment
foo();
function foo() {
throw new Error("Function not implemented.");
}
`
});
| {
"end_byte": 297,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration17.ts"
} |
TypeScript/tests/cases/fourslash/extract-const8.ts_0_363 | /// <reference path='fourslash.ts' />
// @filename: foo.ts
////const foo = 1 * /*a*/(2 + 2)/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`const newLocal = 2 + 2;
const foo = 1 * /*RENAME*/newLocal;`
});
| {
"end_byte": 363,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const8.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses8.ts_0_656 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
////function foo() {
//// const x = {
//// foo: {
//// bar() { return true; }
//// }
//// }
//// if (x.foo.bar/**/) {
//// console.log('test')
//// }
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_call_parentheses.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_missing_call_parentheses.message,
index: 0,
newFileContent:
`function foo() {
const x = {
foo: {
bar() { return true; }
}
}
if (x.foo.bar()) {
console.log('test')
}
}`,
});
| {
"end_byte": 656,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses8.ts"
} |
TypeScript/tests/cases/fourslash/completionOfAwaitPromise3.ts_0_426 | /// <reference path='fourslash.ts'/>
//// interface Foo { ["foo-foo"]: string }
//// async function foo(x: Promise<Foo>) {
//// [|x./**/|]
//// }
const replacementSpan = test.ranges()[0]
verify.completions({
marker: "",
includes: [
"then",
{ name: "foo-foo", insertText: '(await x)["foo-foo"]', replacementSpan, },
],
preferences: {
includeInsertTextCompletions: true,
},
});
| {
"end_byte": 426,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionOfAwaitPromise3.ts"
} |
TypeScript/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParametersNested2D.ts_0_477 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function outer<O>(o: O) {
//// return function inner<I>(i: I) {
//// added/*1*/(o, i);
//// }
////}
goTo.marker("1");
verify.codeFix({
description: "Add missing function declaration 'added'",
index: 0,
newFileContent: `function outer<O>(o: O) {
return function inner<I>(i: I) {
added(o, i);
}
}
function added<O, I>(o: O, i: I) {
throw new Error("Function not implemented.");
}
`,
});
| {
"end_byte": 477,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParametersNested2D.ts"
} |
TypeScript/tests/cases/fourslash/nameOrDottedNameClasses.ts_0_1211 | /// <reference path='fourslash.ts' />
// @BaselineFile: nameOrDottedSpan_classes.baseline
// @Filename: nameOrDottedSpan_classes.ts
////module Foo.Bar {
//// "use strict";
////
//// class Greeter {
//// constructor(public greeting: string) {
//// }
////
//// greet() {
//// return "<h1>" + this.greeting + "</h1>";
//// }
//// }
////
////
//// function foo(greeting: string): Greeter {
//// return new Greeter(greeting);
//// }
////
//// var greeter = new Greeter("Hello, world!");
//// var str = greeter.greet();
////
//// function foo2(greeting: string, ...restGreetings /* more greeting */: string[]) {
//// var greeters: Greeter[] = []; /* inline block comment */
//// greeters[0] = new Greeter(greeting);
//// for (var i = 0; i < restGreetings.length; i++) {
//// greeters.push(new Greeter(restGreetings[i]));
//// }
////
//// return greeters;
//// }
////
//// var b = foo2("Hello", "World", "!");
//// // This is simple signle line comment
//// for (var j = 0; j < b.length; j++) {
//// b[j].greet();
//// }
////}
verify.baselineCurrentFileNameOrDottedNameSpans(); | {
"end_byte": 1211,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/nameOrDottedNameClasses.ts"
} |
TypeScript/tests/cases/fourslash/memberCompletionOnRightSideOfImport.ts_0_116 | /// <reference path="fourslash.ts" />
////import x = M./**/
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 116,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/memberCompletionOnRightSideOfImport.ts"
} |
TypeScript/tests/cases/fourslash/codeFixCorrectReturnValue_all1.ts_0_2277 | /// <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 baz6: () => number = () => { 1 }
////
//// const test: { a: () => A } = { a: () => { bar: '1' } }
verify.codeFixAll({
fixId: "fixAddReturnStatement",
fixAllDescription: "Add all missing return statement",
newFileContent:
`interface A {
bar: string
}
function foo1 (_a: () => number ) { }
foo1(() => {
return 1
})
function foo2 (_a: () => A) { }
foo2(() => {
return { bar: '1' }
})
foo2(() => {
return { bar: '1' }
})
function foo3 (_a: () => A | number) { }
foo3(() => {
return 1
})
foo3(() => {
return { bar: '1' }
})
function bar1 (): number {
return 1
}
function bar2 (): A {
return { bar: '1' }
}
function bar3 (): A {
return { bar: '1' }
}
function bar4 (): A | number {
return 1
}
function bar5(): A | number {
return { bar: '1' }
}
const baz1: () => number = () => {
return 1
}
const baz2: () => A = () => {
return { bar: '1' }
}
const baz3: () => A = () => {
return { bar: '1' }
}
const baz4: ((() => number) | (() => A)) = () => {
return 1
}
const baz5: ((() => number) | (() => A)) = () => {
return { bar: '1' }
}
const baz6: () => number = () => { return 1 }
const test: { a: () => A } = { a: () => { return { bar: '1' } } }`,
}); | {
"end_byte": 2277,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixCorrectReturnValue_all1.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesThrow4.ts_0_930 | /// <reference path='fourslash.ts' />
////function f(a: number) {
//// try {
//// throw "Hello";
////
//// try {
//// throw 10;
//// }
//// catch (x) {
//// return 100;
//// }
//// finally {
//// throw 10;
//// }
//// }
//// catch (x) {
//// throw "Something";
//// }
//// finally {
//// throw "Also something";
//// }
//// if (a > 0) {
//// return (function () {
//// [|return|];
//// [|return|];
//// [|return|];
////
//// if (false) {
//// [|return|] true;
//// }
//// [|th/**/row|] "Hello!";
//// })() || true;
//// }
////
//// throw 10;
////
//// var unusued = [1, 2, 3, 4].map(x => { throw 4 })
////
//// return;
//// return true;
//// throw false;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 930,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesThrow4.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJSDocBackticks.ts_0_761 | ///<reference path="fourslash.ts" />
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: jsdocParseMatchingBackticks.js
/////**
//// * `@param` initial at-param is OK in title comment
//// * @param {string} x hi there `@param`
//// * @param {string} y hi there `@ * param
//// * this is the margin
//// */
////export function f(x, y) {
//// return x/*x*/ + y/*y*/
////}
////f/*f*/
goTo.marker("f");
verify.quickInfoIs("function f(x: string, y: string): string", "`@param` initial at-param is OK in title comment");
goTo.marker("x");
verify.quickInfoIs("(parameter) x: string", "hi there `@param`");
goTo.marker("y");
verify.quickInfoIs("(parameter) y: string", "hi there `@ * param\nthis is the margin");
| {
"end_byte": 761,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJSDocBackticks.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpExpandedRestTuplesLocalLabels1.ts_0_2530 | /// <reference path='fourslash.ts' />
// from: https://github.com/microsoft/TypeScript/pull/57619
//// interface AppleInfo {
//// color: "green" | "red";
//// }
////
//// interface BananaInfo {
//// curvature: number;
//// }
////
//// type FruitAndInfo1 = ["apple", AppleInfo] | ["banana", BananaInfo];
////
//// function logFruitTuple1(...[fruit, info]: FruitAndInfo1) {}
//// logFruitTuple1(/*1*/);
////
//// function logFruitTuple2(...[, info]: FruitAndInfo1) {}
//// logFruitTuple2(/*2*/);
//// logFruitTuple2("apple", /*3*/);
////
//// function logFruitTuple3(...[fruit, ...rest]: FruitAndInfo1) {}
//// logFruitTuple3(/*4*/);
//// logFruitTuple3("apple", /*5*/);
//// function logFruitTuple4(...[fruit, ...[info]]: FruitAndInfo1) {}
//// logFruitTuple4(/*6*/);
//// logFruitTuple4("apple", /*7*/);
////
//// type FruitAndInfo2 = ["apple", ...AppleInfo[]] | ["banana", ...BananaInfo[]];
////
//// function logFruitTuple5(...[fruit, firstInfo]: FruitAndInfo2) {}
//// logFruitTuple5(/*8*/);
//// logFruitTuple5("apple", /*9*/);
////
//// function logFruitTuple6(...[fruit, ...fruitInfo]: FruitAndInfo2) {}
//// logFruitTuple6(/*10*/);
//// logFruitTuple6("apple", /*11*/);
////
//// type FruitAndInfo3 = ["apple", ...AppleInfo[], number] | ["banana", ...BananaInfo[], number];
////
//// function logFruitTuple7(...[fruit, fruitInfoOrNumber, secondFruitInfoOrNumber]: FruitAndInfo3) {}
//// logFruitTuple7(/*12*/);
//// logFruitTuple7("apple", /*13*/);
//// logFruitTuple7("apple", { color: "red" }, /*14*/);
////
//// function logFruitTuple8(...[fruit, , secondFruitInfoOrNumber]: FruitAndInfo3) {}
//// logFruitTuple8(/*15*/);
//// logFruitTuple8("apple", /*16*/);
//// logFruitTuple8("apple", { color: "red" }, /*17*/);
////
//// function logFruitTuple9(...[...[fruit, fruitInfoOrNumber, secondFruitInfoOrNumber]]: FruitAndInfo3) {}
//// logFruitTuple9(/*18*/);
//// logFruitTuple9("apple", /*19*/);
//// logFruitTuple9("apple", { color: "red" }, /*20*/);
////
//// function logFruitTuple10(...[fruit, {}, secondFruitInfoOrNumber]: FruitAndInfo3) {}
//// logFruitTuple10(/*21*/);
//// logFruitTuple10("apple", /*22*/);
//// logFruitTuple10("apple", { color: "red" }, /*23*/);
////
//// function logFruitTuple11(...{}: FruitAndInfo3) {}
//// logFruitTuple11(/*24*/);
//// logFruitTuple11("apple", /*25*/);
//// logFruitTuple11("apple", { color: "red" }, /*26*/);
//// function withPair(...[first, second]: [number, named: string]) {}
//// withPair(/*27*/);
//// withPair(101, /*28*/);
verify.baselineSignatureHelp();
| {
"end_byte": 2530,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpExpandedRestTuplesLocalLabels1.ts"
} |
TypeScript/tests/cases/fourslash/completionImportAttributes.ts_0_241 | /// <reference path='fourslash.ts' />
// @target: esnext
// @module: esnext
// @filename: main.ts
////import("./other.json", {/*0*/});
////import("./other.json", { wi/*1*/});
// @filename: other.json
////{}
verify.baselineCompletions();
| {
"end_byte": 241,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionImportAttributes.ts"
} |
TypeScript/tests/cases/fourslash/completionsImportDeclarationAttributesEmptyModuleSpecifier1.ts_0_314 | /// <reference path='fourslash.ts' />
// @strict: true
// @filename: global.d.ts
//// interface ImportAttributes {
//// type: "json";
//// }
// @filename: index.ts
//// import * as ns from "" with { type: "/**/" };
verify.completions({
marker: "",
exact: ["json"],
isNewIdentifierLocation: false,
});
| {
"end_byte": 314,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImportDeclarationAttributesEmptyModuleSpecifier1.ts"
} |
TypeScript/tests/cases/fourslash/goToImplementationInterface_06.ts_0_422 | /// <reference path='fourslash.ts'/>
// Should go to class expressions that implement a constructor type
//// interface Fo/*interface_definition*/o {
//// new (a: number): SomeOtherType;
//// }
////
//// interface SomeOtherType {}
////
//// let x: Foo = [|class { constructor (a: number) {} }|];
//// let y = <Foo> [|class { constructor (a: number) {} }|];
verify.baselineGoToImplementation("interface_definition"); | {
"end_byte": 422,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToImplementationInterface_06.ts"
} |
TypeScript/tests/cases/fourslash/syntacticClassificationsConflictMarkers1.ts_0_747 | /// <reference path="fourslash.ts"/>
////class C {
////<<<<<<< HEAD
//// v = 1;
////=======
//// v = 2;
////>>>>>>> Branch - a
////}
const c = classification("original");
verify.syntacticClassificationsAre(
c.keyword("class"), c.className("C"), c.punctuation("{"),
c.comment("<<<<<<< HEAD"),
c.identifier("v"), c.operator("="), c.numericLiteral("1"), c.punctuation(";"),
c.comment("======="),
c.identifier("v"), c.punctuation("="), c.numericLiteral("2"), c.punctuation(";"),
c.comment(">>>>>>> Branch - a"),
c.punctuation("}"));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("class.declaration", "C"),
c2.semanticToken("property.declaration", "v"),
);
| {
"end_byte": 747,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/syntacticClassificationsConflictMarkers1.ts"
} |
TypeScript/tests/cases/fourslash/semanticClassificationModules.ts_0_1144 | /// <reference path="fourslash.ts"/>
////module /*0*/M {
//// export var v;
//// export interface /*1*/I {
//// }
////}
////
////var x: /*2*/M./*3*/I = /*4*/M.v;
////var y = /*5*/M;
const c = classification("original");
verify.semanticClassificationsAre("original",
c.moduleName("M", test.marker("0").position),
c.interfaceName("I", test.marker("1").position),
c.moduleName("M", test.marker("2").position),
c.interfaceName("I", test.marker("3").position),
c.moduleName("M", test.marker("4").position),
c.moduleName("M", test.marker("5").position));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("namespace.declaration", "M"),
c2.semanticToken("variable.declaration.local", "v"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "x"),
c2.semanticToken("namespace", "M"),
c2.semanticToken("interface", "I"),
c2.semanticToken("namespace", "M"),
c2.semanticToken("variable.local", "v"),
c2.semanticToken("variable.declaration", "y"),
c2.semanticToken("namespace", "M"),
);
| {
"end_byte": 1144,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticClassificationModules.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstInForLoopWithArrayDestructuring1.ts_0_196 | /// <reference path='fourslash.ts' />
////for ([x] of [[1,2]]) {}
verify.codeFix({
description: "Add 'const' to unresolved variable",
newFileContent: "for (const [x] of [[1,2]]) {}"
});
| {
"end_byte": 196,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstInForLoopWithArrayDestructuring1.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixExistingImport0.ts_0_218 | /// <reference path="fourslash.ts" />
//// import [|{ v1 }|] from "./module";
//// f1/*0*/();
// @Filename: module.ts
//// export function f1() {}
//// export var v1 = 5;
verify.importFixAtPosition([`{ f1, v1 }`]);
| {
"end_byte": 218,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixExistingImport0.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_reExport_wrongName.ts_0_1192 | /// <reference path="fourslash.ts" />
// @moduleResolution: node
// @Filename: /a.ts
////export const x = 0;
// @Filename: /index.ts
////export { x as y } from "./a";
// @Filename: /c.ts
/////**/
goTo.marker("");
verify.completions({
marker: "",
includes: [
{
name: "x",
source: "/a",
sourceDisplay: "./a",
text: "const x: 0",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
{
name: "y",
source: "/index",
sourceDisplay: ".",
text: "(alias) const y: 0\nexport y",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
],
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "x",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `import { x } from "./a";
`,
});
verify.applyCodeActionFromCompletion("", {
name: "y",
source: "/index",
description: `Add import from "."`,
newFileContent: `import { y } from ".";
import { x } from "./a";
`,
});
| {
"end_byte": 1192,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_reExport_wrongName.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_declarationKinds.ts_0_680 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export {}; // make this a module
////[|const x = 0;
////function f() {}
////class C {}
////enum E {}
////namespace N { export const x = 0; }
////type T = number;
////interface I {}|]
////x; f; C; E; N;
////type U = T; type V = I;
verify.moveToNewFile({
newFileContents: {
"/a.ts":
`import { x, f, C, E, N, T, I } from "./x";
export {}; // make this a module
x; f; C; E; N;
type U = T; type V = I;`,
"/x.ts":
`export const x = 0;
export function f() { }
export class C { }
export enum E { }
export namespace N { export const x = 0; }
export type T = number;
export interface I { }
`,
},
});
| {
"end_byte": 680,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_declarationKinds.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionUnionTypeProperty2.ts_0_399 | /// <reference path='fourslash.ts' />
////interface HasAOrB {
//// /*propertyDefinition1*/a: string;
//// b: string;
////}
////
////interface One {
//// common: { /*propertyDefinition2*/a : number; };
////}
////
////interface Two {
//// common: HasAOrB;
////}
////
////var x : One | Two;
////
////x.common.[|/*propertyReference*/a|];
verify.baselineGoToDefinition("propertyReference");
| {
"end_byte": 399,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionUnionTypeProperty2.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFix_jsx7.ts_0_299 | /// <reference path="fourslash.ts" />
// @jsx: react
// @module: esnext
// @esModuleInterop: true
// @moduleResolution: node
// @Filename: /node_modules/react/index.d.ts
////// React was not defined
// @Filename: /a.tsx
////<[|Text|]></Text>;
goTo.file("/a.tsx");
verify.not.codeFixAvailable();
| {
"end_byte": 299,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFix_jsx7.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts_0_305 | /// <reference path="fourslash.ts" />
//// /**
//// * @return Don't @ me
//// */
//// function /*f*/f() { }
//// /**
//// * @return One final @
//// */
//// function /*g*/g() { }
//// /**
//// * @return An @
//// * But another line
//// */
//// function /*h*/h() { }
verify.baselineQuickInfo()
| {
"end_byte": 305,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoJSDocAtBeforeSpace.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsSymbols2.ts_0_1156 | /// <reference path="fourslash.ts"/>
////interface I {
//// [Symbol.isRegExp]: string;
//// [Symbol.iterator](): string;
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "I",
"kind": "interface",
"childItems": [
{
"text": "[Symbol.isRegExp]",
"kind": "property"
},
{
"text": "[Symbol.iterator]",
"kind": "method"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "I",
"kind": "interface"
}
]
},
{
"text": "I",
"kind": "interface",
"childItems": [
{
"text": "[Symbol.isRegExp]",
"kind": "property"
},
{
"text": "[Symbol.iterator]",
"kind": "method"
}
],
"indent": 1
}
]);
| {
"end_byte": 1156,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsSymbols2.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnAccessors01.ts_0_840 | /// <reference path='fourslash.ts' />
////class Foo {
//// get foo(a,
//// /*1*/b,/*0*/
//// //comment/*2*/
//// /*3*/c
//// ) {
//// }
//// set foo(a,
//// /*5*/b,/*4*/
//// //comment/*6*/
//// /*7*/c
//// ) {
//// }
////}
goTo.marker("0");
edit.insert("\n");
verify.indentationIs(8);
goTo.marker("1");
verify.currentLineContentIs(" b,");
goTo.marker("2");
verify.currentLineContentIs(" //comment");
goTo.marker("3");
verify.currentLineContentIs(" c");
goTo.marker("4");
edit.insert("\n");
verify.indentationIs(8);
goTo.marker("5");
verify.currentLineContentIs(" b,");
goTo.marker("6");
verify.currentLineContentIs(" //comment");
goTo.marker("7");
verify.currentLineContentIs(" c"); | {
"end_byte": 840,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnAccessors01.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts_0_145 | /// <reference path='fourslash.ts' />
////let o = { /*1*/"/*2*/x": 12 };
////let y = o./*3*/x;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 145,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport3.ts_0_1225 | /// <reference path="fourslash.ts" />
// @module: esnext
// @verbatimModuleSyntax: true
// @Filename: exports1.ts
////export default class A {}
////export class B {}
////export class C {}
// @Filename: exports2.ts
////export default class D {}
////export class E {}
////export class F {}
// @Filename: imports.ts
////import A, { B, C } from './exports1';
////import D, * as others from "./exports2";
////
////declare const a: A;
////declare const b: B;
////declare const c: C;
////declare const d: D;
////declare const o: typeof others;
////console.log(a, b, c, d, o);
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": 1225,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassImplementInterface_order.ts_0_482 | /// <reference path='fourslash.ts' />
// #34841
////interface IFoo {
//// bar(): void;
////}
////
////class Foo implements IFoo {
//// private x = 1;
//// constructor() { this.x = 2 }
////}
verify.codeFix({
description: "Implement interface 'IFoo'",
index: 0,
newFileContent:
`interface IFoo {
bar(): void;
}
class Foo implements IFoo {
private x = 1;
constructor() { this.x = 2 }
bar(): void {
throw new Error("Method not implemented.");
}
}`});
| {
"end_byte": 482,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassImplementInterface_order.ts"
} |
TypeScript/tests/cases/fourslash/contextualTypingOfGenericCallSignatures1.ts_0_213 | /// <reference path='fourslash.ts'/>
////var f24: {
//// <T, U>(x: T): U
////};
////// x should not be contextually typed
////var f24 = (/**/x) => { return 1 };
verify.quickInfoAt("", "(parameter) x: any");
| {
"end_byte": 213,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/contextualTypingOfGenericCallSignatures1.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules2.ts_0_877 | /// <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: /other.ts
//// import "node:fs/promises";
// @Filename: /index.ts
//// write/**/
verify.completions({
marker: "",
exact: completion.globalsPlus([{
name: "writeFile",
source: "node:fs",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}, {
name: "writeFile",
source: "node:fs/promises",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
}]),
preferences: {
includeCompletionsForModuleExports: true,
},
});
| {
"end_byte": 877,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_uriStyleNodeCoreModules2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingParam11.ts_0_310 | /// <reference path="fourslash.ts" />
////class C {
//// [|private p = () => {}|]
//// m(a: boolean) {
//// this.p(a);
//// }
////}
verify.codeFix({
description: [ts.Diagnostics.Add_missing_parameter_to_0.message, "p"],
index: 0,
newRangeContent: "private p = (a: boolean) => {}"
});
| {
"end_byte": 310,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingParam11.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts_0_196 | /// <reference path="fourslash.ts" />
//// function method() { var /**/dictionary = <{ [index]: string; }>{}; }
verify.quickInfoAt("", "(local var) dictionary: {\n [x: number]: string;\n}");
| {
"end_byte": 196,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInInvalidIndexSignature.ts"
} |
TypeScript/tests/cases/fourslash/jsxTsIgnoreOnJSXExpressionsAndChildren.ts_0_1923 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @jsx: react
// @esModuleInterop: true
// @skipLibCheck: true
// @Filename: declarations.d.ts
////declare namespace JSX {
//// interface Element {}
//// interface IntrinsicElements { [index: string]: {} }
////}
////declare var React: any;
// @Filename: MyComponent.jsx
////class MyComponent extends React.Component {
//// render() {
//// return (
//// <div>
//// {[|/*1*/doesNotExist|]}
//// </div>
//// );
//// }
////}
// @Filename: MyComponent2.jsx
////class MyComponent2 extends React.Component {
//// render() {
//// return (
//// <div>
//// Aleph{[|/*2*/doesNotExist|]}Bet
//// </div>
//// );
//// }
////}
// @Filename: MyComponent3.jsx
////class MyComponent3 extends React.Component {
//// render() {
//// return (
//// <div>
//// <[|/*3*/DoesNotExist|] />
//// </div>
//// );
//// }
////}
goTo.file(1);
verify.getSyntacticDiagnostics([]);
verify.getSemanticDiagnostics([{ code: 2304, message: "Cannot find name 'doesNotExist'." }]);
verify.codeFix({
index: 0,
description: "Ignore this error message",
newFileContent: `class MyComponent extends React.Component {
render() {
return (
<div>
{
// @ts-ignore
doesNotExist}
</div>
);
}
}`
});
goTo.file(2);
verify.codeFix({
index: 0,
description: "Ignore this error message",
newFileContent: `class MyComponent2 extends React.Component {
render() {
return (
<div>
Aleph{
// @ts-ignore
doesNotExist}Bet
</div>
);
}
}`
});
goTo.file(3);
verify.codeFix({
index: 0,
description: "Ignore this error message",
newFileContent: `class MyComponent3 extends React.Component {
render() {
return (
<div>
<
// @ts-ignore
DoesNotExist />
</div>
);
}
}`
});
| {
"end_byte": 1923,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxTsIgnoreOnJSXExpressionsAndChildren.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationFor.ts_0_681 | /// <reference path='fourslash.ts' />
// @BaselineFile: bpSpan_for.baseline
// @Filename: bpSpan_for.ts
////for (var i = 0; i < 10; i++) {
//// WScript.Echo("i: " + i);
////}
////for (i = 0; i < 10; i++)
////{
//// WScript.Echo("i: " + i);
////}
////for (var j = 0; j < 10; ) {
//// j++;
//// if (j == 1) {
//// continue;
//// }
////}
////for (j = 0; j < 10;)
////{
//// j++;
////}
////for (var k = 0;; k++) {
////}
////for (k = 0;; k++)
////{
////}
////for (; k < 10; k++) {
////}
////for (;;) {
//// i++;
////}
////for (;;)
////{
//// i++;
////}
////for (i = 0, j = 20; j < 20, i < 20; j++) {
////}
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 681,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationFor.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConstToLet4.ts_0_214 | /// <reference path='fourslash.ts' />
////// Comment
////const a = 1;
////a = 2;
verify.codeFix({
description: "Convert 'const' to 'let'",
index: 0,
newFileContent:
`// Comment
let a = 1;
a = 2;`
});
| {
"end_byte": 214,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConstToLet4.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoInheritDoc6.ts_0_330 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: quickInfoInheritDoc6.js
////class B extends UNRESOLVED_VALUE_DEFINITELY_DOES_NOT_EXIST {
//// /**
//// * @inheritdoc
//// */
//// static /**/value() {
//// return undefined;
//// }
////}
verify.baselineQuickInfo();
| {
"end_byte": 330,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoInheritDoc6.ts"
} |
TypeScript/tests/cases/fourslash/jsTagAfterCallback1.ts_0_473 | /// <reference path='fourslash.ts' />
// @Filename: foo.js
// @allowJs: true
// @checkJs: true
//// /** @callback Listener @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": 473,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsTagAfterCallback1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties26.ts_0_414 | /// <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": 414,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties26.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToOptionalChainExpression_BinaryExpressionPartialSpan.ts_0_431 | /// <reference path='fourslash.ts' />
////let foo = { bar: { baz: 0 } };
////f/*a*/oo && foo.bar && foo.bar.ba/*b*/z;
// 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;`
}); | {
"end_byte": 431,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToOptionalChainExpression_BinaryExpressionPartialSpan.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_details_withMisspelledName.ts_0_628 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////export const abc = 0;
// @Filename: /b.ts
////acb/*1*/;
// @Filename: /c.ts
////acb/*2*/;
goTo.marker("1");
verify.applyCodeActionFromCompletion("1", {
name: "abc",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `import { abc } from "./a";
acb;`,
});
goTo.marker("2");
verify.applyCodeActionFromCompletion("2", {
name: "abc",
source: "/a",
data: {
exportName: "abc",
fileName: "/a.ts",
},
description: `Add import from "./a"`,
newFileContent: `import { abc } from "./a";
acb;`,
});
| {
"end_byte": 628,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_details_withMisspelledName.ts"
} |
TypeScript/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterArgumentSame.ts_0_429 | /// <reference path='fourslash.ts' />
// @noImplicitAny: true
////function existing<T>(value: T) {
//// added/*1*/<T>(value, value);
////}
goTo.marker("1");
verify.codeFix({
description: "Add missing function declaration 'added'",
index: 0,
newFileContent: `function existing<T>(value: T) {
added<T>(value, value);
}
function added<T>(value: T, value1: T) {
throw new Error("Function not implemented.");
}
`,
});
| {
"end_byte": 429,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/incompleteFunctionCallCodefixTypeParameterArgumentSame.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelp_unionType.ts_0_501 | /// <reference path="fourslash.ts" />
////declare const a: (fn?: ((x: string) => string) | ((y: number) => number)) => void;
////declare const b: (x: string | number) => void;
////
////interface Callback {
//// (x: string): string;
//// (x: number): number;
//// (x: string | number): string | number;
////}
////declare function c(callback: Callback): void;
////a((/*1*/) => {
//// return undefined;
////});
////
////b(/*2*/);
////
////c((/*3*/) => {});
verify.baselineSignatureHelp();
| {
"end_byte": 501,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelp_unionType.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_export_object_shorthand.ts_0_338 | /// <reference path='fourslash.ts' />
// TODO: Maybe we could transform this to `export function f() {}`.
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////function f() {}
////module.exports = { f };
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`function f() {}
export default { f };`,
});
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_export_object_shorthand.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsInteractiveParameterNames.ts_0_1031 | /// <reference path="fourslash.ts" />
//// function foo1 (a: number, b: number) {}
//// foo1(1, 2);
//// function foo2 (a: number, { c }: any) {}
//// foo2(1, { c: 1 });
////const foo3 = (a = 1) => class { }
////const C1 = class extends foo3(1) { }
////class C2 extends foo3(1) { }
////function foo4(a: number, b: number, c: number, d: number) {}
////foo4(1, +1, -1, +"1");
////function foo5(
//// a: string,
//// b: undefined,
//// c: null,
//// d: boolean,
//// e: boolean,
//// f: number,
//// g: number,
//// h: number,
//// i: RegExp,
//// j: bigint,
////) {
////}
////foo5(
//// "hello",
//// undefined,
//// null,
//// true,
//// false,
//// Infinity,
//// -Infinity,
//// NaN,
//// /hello/g,
//// 123n,
////);
//// declare const unknownCall: any;
//// unknownCall();
////function trace(message: string) {}
////trace(`${1}`);
////trace(``);
verify.baselineInlayHints(undefined, { includeInlayParameterNameHints: "literals", interactiveInlayHints: true });
| {
"end_byte": 1031,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsInteractiveParameterNames.ts"
} |
TypeScript/tests/cases/fourslash/completionListAfterSlash.ts_0_141 | /// <reference path='fourslash.ts' />
////var a = 0;
////a/./**/
// should not crash
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 141,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAfterSlash.ts"
} |
TypeScript/tests/cases/fourslash/genericSignaturesAreProperlyCleaned.ts_0_302 | /// <reference path='fourslash.ts' />
////interface Int<T> {
////val<U>(f: (t: T) => U): Int<U>;
////}
////declare var v1: Int<string>;
////var v2: Int<number> = v1/*1*/;
verify.numberOfErrorsInCurrentFile(1);
goTo.marker('1');
edit.deleteAtCaret(';'.length);
verify.numberOfErrorsInCurrentFile(1);
| {
"end_byte": 302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericSignaturesAreProperlyCleaned.ts"
} |
TypeScript/tests/cases/fourslash/completionAfterDotDotDot.ts_0_114 | /// <reference path='fourslash.ts'/>
////.../**/
verify.completions({ marker: "", exact: completion.globals });
| {
"end_byte": 114,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAfterDotDotDot.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionVariableAssignment1.ts_0_275 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @filename: foo.js
////const Foo = module./*def*/exports = function () {}
////Foo.prototype.bar = function() {}
////new [|Foo/*ref*/|]();
goTo.file("foo.js");
verify.baselineGoToDefinition("ref");
| {
"end_byte": 275,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionVariableAssignment1.ts"
} |
TypeScript/tests/cases/fourslash/completionsImportWithKeyword.ts_0_426 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.ts
//// const f = {
//// a: 1
////};
//// import * as thing from "thing" /*0*/
//// export { foo } from "foo" /*1*/
//// import "foo" as /*2*/
//// import "foo" w/*3*/
//// import * as that from "that"
//// /*4*/
//// import * /*5*/ as those from "those"
// @Filename: b.js
//// import * as thing from "thing" /*js*/;
verify.baselineCompletions();
| {
"end_byte": 426,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImportWithKeyword.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageSingleLineClassJS.ts_0_396 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @noImplicitAny: true
// @Filename: important.js
////class C {m(x) {return x;}}
////var c = new C()
////c.m(1)
verify.codeFix({
description: "Infer parameter types from usage",
index: 0,
newFileContent:
`class C {/**
* @param {number} x
*/
m(x) {return x;}}
var c = new C()
c.m(1)`,
});
| {
"end_byte": 396,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageSingleLineClassJS.ts"
} |
TypeScript/tests/cases/fourslash/jsxFindAllReferencesOnRuntimeImportWithPaths1.ts_0_892 | /// <reference path="fourslash.ts" />
// @Filename: project/src/foo.ts
////import * as x from /**/"@foo/dir/jsx-runtime";
// @Filename: project/src/bar.tsx
////export default <div></div>;
// @Filename: project/src/baz.tsx
////export default <></>;
// @Filename: project/src/bam.tsx
////export default <script src=""/>;
// @Filename: project/src/bat.tsx
////export const a = 1;
// @Filename: project/src/bal.tsx
////
// @Filename: project/src/dir/jsx-runtime.ts
////export {}
// @Filename: project/tsconfig.json
////{
//// "compilerOptions": {
//// "moduleResolution": "node",
//// "module": "es2020",
//// "jsx": "react-jsx",
//// "jsxImportSource": "@foo/dir",
//// "moduleDetection": "force",
//// "paths": {
//// "@foo/dir/jsx-runtime": ["./src/dir/jsx-runtime"]
//// }
//// }
////}
verify.baselineFindAllReferences("");
| {
"end_byte": 892,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxFindAllReferencesOnRuntimeImportWithPaths1.ts"
} |
TypeScript/tests/cases/fourslash/autoImportFileExcludePatterns5.ts_0_977 | /// <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/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": 977,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportFileExcludePatterns5.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion2.ts_0_3010 | ///<reference path="fourslash.ts" />
//// // overloads
//// declare function foo(a: string): number;
//// /** @deprecated */
//// declare function foo(): undefined;
//// declare function foo (a?: string): number | undefined;
//// [|foo|]();
//// foo('');
//// foo;
//// /** @deprecated */
//// declare function bar(): number;
//// [|bar|]();
//// [|bar|];
//// /** @deprecated */
//// declare function baz(): number;
//// /** @deprecated */
//// declare function baz(): number | undefined;
//// [|baz|]();
//// [|baz|];
//// interface Foo {
//// /** @deprecated */
//// (): void
//// (a: number): void
//// }
//// declare const f: Foo;
//// [|f|]();
//// f(1);
//// interface T {
//// createElement(): void
//// /** @deprecated */
//// createElement(tag: 'xmp'): void;
//// }
//// declare const t: T;
//// t.createElement();
//// t.[|createElement|]('xmp');
//// declare class C {
//// /** @deprecated */
//// constructor ();
//// constructor(v: string)
//// }
//// C;
//// const c = new [|C|]();
//// interface Ca {
//// /** @deprecated */
//// (): void
//// new (): void
//// }
//// interface Cb {
//// (): void
//// /** @deprecated */
//// new (): string
//// }
//// declare const ca: Ca;
//// declare const cb: Cb;
//// ca;
//// cb;
//// [|ca|]();
//// cb();
//// new ca();
//// new [|cb|]();
const ranges = test.ranges();
verify.getSuggestionDiagnostics([
{
message: "The signature '(): undefined' of 'foo' is deprecated.",
code: 6387,
range: ranges[0],
reportsDeprecated: true,
},
{
message: "The signature '(): number' of 'bar' is deprecated.",
code: 6387,
range: ranges[1],
reportsDeprecated: true,
},
{
message: "'bar' is deprecated.",
code: 6385,
range: ranges[2],
reportsDeprecated: true,
},
{
message: "The signature '(): number' of 'baz' is deprecated.",
code: 6387,
range: ranges[3],
reportsDeprecated: true,
},
{
message: "'baz' is deprecated.",
code: 6385,
range: ranges[4],
reportsDeprecated: true,
},
{
message: "The signature '(): void' of 'f' is deprecated.",
code: 6387,
range: ranges[5],
reportsDeprecated: true,
},
{
message: `The signature '(tag: "xmp"): void' of 't.createElement' is deprecated.`,
code: 6387,
range: ranges[6],
reportsDeprecated: true,
},
{
message: `The signature '(): C' of 'C' is deprecated.`,
code: 6387,
range: ranges[7],
reportsDeprecated: true,
},
{
message: `The signature '(): void' of 'ca' is deprecated.`,
code: 6387,
range: ranges[8],
reportsDeprecated: true,
},
{
message: `The signature '(): string' of 'cb' is deprecated.`,
code: 6387,
range: ranges[9],
reportsDeprecated: true,
},
])
| {
"end_byte": 3010,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion2.ts"
} |
TypeScript/tests/cases/fourslash/inlayHintsTypeMatchesName.ts_0_290 | /// <reference path="fourslash.ts" />
//// type Client = {};
//// function getClient(): Client { return {}; };
//// const client = getClient();
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true,
includeInlayVariableTypeHintsWhenTypeMatchesName: false
});
| {
"end_byte": 290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlayHintsTypeMatchesName.ts"
} |
TypeScript/tests/cases/fourslash/importDeclPaste0.ts_0_330 | /// <reference path="fourslash.ts" />
//// // @Filename: exportEqualsInterface_A.ts
//// interface A {
//// p1: number;
//// }
////
//// export = A;
//// /*1*/
//// var i: I1;
////
//// var n: number = i.p1;
edit.disableFormatting();
goTo.marker('1');
//edit.insert("\nimport I1 = module(\"exportEqualsInterface_A\");\n");
| {
"end_byte": 330,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importDeclPaste0.ts"
} |
TypeScript/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts_0_614 | /// <reference path="fourslash.ts"/>
////declare module /*0*/M {
//// interface /*1*/I {
////
//// }
////}
////
////var M = { I: 10 };
const c = classification("original");
verify.semanticClassificationsAre("original",
c.moduleName("M", test.marker("0").position),
c.interfaceName("I", test.marker("1").position));
const c2 = classification("2020");
verify.semanticClassificationsAre("2020",
c2.semanticToken("variable", "M"),
c2.semanticToken("interface.declaration", "I"),
c2.semanticToken("variable.declaration", "M"),
c2.semanticToken("property.declaration", "I"),
);
| {
"end_byte": 614,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/semanticClassificationUninstantiatedModuleWithVariableOfSameName1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile2.ts_0_314 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @noEmit: true
// @checkJs: true
// @Filename: a.js
////[|var x = "";
////x = 1;|]
// Disable checking for the whole file
verify.rangeAfterCodeFix(`// @ts-nocheck
var x = "";
x = 1;`, /*includeWhiteSpace*/ false, /*errorCode*/ undefined, /*index*/ 1);
| {
"end_byte": 314,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile2.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsClass3.ts_0_812 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @filename: /foo.js
////function Foo() {}
////class Foo {}
verify.navigationTree({
text: "<global>",
kind: "script",
childItems: [
{
text: "Foo",
kind: "function"
},
{
text: "Foo",
kind: "class"
}
]
});
verify.navigationBar([
{
text: "<global>",
kind: "script",
childItems: [
{
text: "Foo",
kind: "function"
},
{
text: "Foo",
kind: "class"
}
]
},
{
text: "Foo",
kind: "function",
indent: 1
},
{
text: "Foo",
kind: "class",
indent: 1
}
]);
| {
"end_byte": 812,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsClass3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixOverrideModifier6.ts_0_429 | /// <reference path='fourslash.ts' />
// @noImplicitOverride: true
//// class B {
//// foo (v: string) {}
//// fooo (v: string) {}
//// }
//// function f () {
//// return class extends B {
//// override foo (v: string) {}
//// [|override bar(v: string) {}|]
//// }
//// }
verify.codeFix({
description: "Remove 'override' modifier",
newRangeContent: 'bar(v: string) {}',
index: 0
})
| {
"end_byte": 429,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixOverrideModifier6.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpOnSuperWhenMembersAreNotResolved.ts_0_290 | /// <reference path="fourslash.ts" />
////class A { }
////class B extends A { constructor(public x: string) { } }
////class C extends B {
//// constructor() {
//// /*1*/
//// }
////}
goTo.marker("1");
edit.insert("super(");
verify.signatureHelp({ text: "B(x: string): B" }); | {
"end_byte": 290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnSuperWhenMembersAreNotResolved.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties_PreserveIndent.ts_0_1021 | /// <reference path='fourslash.ts' />
////interface Test {
//// foo: string;
//// bar(a: string): void;
////}
////function f (_spec: any) {}
////function g (_spec: Test) {}
////[|f(() => {
//// g({});
//// g(
//// {});
//// g(
//// {}
//// );
////});|]
verify.codeFixAll({
fixId: "fixMissingProperties",
fixAllDescription: ts.Diagnostics.Add_all_missing_properties.message,
newFileContent: `interface Test {
foo: string;
bar(a: string): void;
}
function f (_spec: any) {}
function g (_spec: Test) {}
f(() => {
g({
foo: "",
bar: function(a: string): void {
throw new Error("Function not implemented.");
}
});
g(
{
foo: "",
bar: function(a: string): void {
throw new Error("Function not implemented.");
}
});
g(
{
foo: "",
bar: function(a: string): void {
throw new Error("Function not implemented.");
}
}
);
});`,
});
| {
"end_byte": 1021,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties_PreserveIndent.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromFunctionThisUsageNoUses.ts_0_281 | /// <reference path='fourslash.ts' />
// @noImplicitThis: true
////function returnThisMember([| |]) {
//// return this.member;
//// }
verify.codeFix({
description: "Infer 'this' type of 'returnThisMember' from usage",
index: 0,
newRangeContent: "this: any ",
});
| {
"end_byte": 281,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromFunctionThisUsageNoUses.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.