_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts_0_1022 | /// <reference path='fourslash.ts' />
/////*1*/({});
/////*2*/( {});
/////*3*/({foo:42});
/////*4*/( {foo:42} );
/////*5*/var bar = (function (a) { });
format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", true);
format.document();
goTo.marker('1');
verify.currentLineContentIs('( {} );');
goTo.marker('2');
verify.currentLineContentIs('( {} );');
goTo.marker('3');
verify.currentLineContentIs('( { foo: 42 } );');
goTo.marker('4');
verify.currentLineContentIs('( { foo: 42 } );');
goTo.marker('5');
verify.currentLineContentIs('var bar = ( function( a ) { } );');
format.setOption("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", false);
format.document();
goTo.marker('1');
verify.currentLineContentIs('({});');
goTo.marker('2');
verify.currentLineContentIs('({});');
goTo.marker('3');
verify.currentLineContentIs('({ foo: 42 });');
goTo.marker('4');
verify.currentLineContentIs('({ foo: 42 });');
goTo.marker('5');
verify.currentLineContentIs('var bar = (function(a) { });'); | {
"end_byte": 1022,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formattingSpaceBeforeCloseParen.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration28.ts_0_1391 | /// <reference path='fourslash.ts' />
////foo({
//// prop001: '',
//// prop002: '',
//// prop003: '',
//// prop004: '',
//// prop005: '',
//// prop006: '',
//// prop007: '',
//// prop008: '',
//// prop009: '',
//// prop010: '',
//// prop011: '',
//// prop012: '',
//// prop013: '',
//// prop014: '',
//// prop015: '',
//// prop016: '',
//// prop017: '',
//// prop018: '',
//// prop019: '',
//// prop020: '',
////});
verify.codeFix({
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"],
index: 0,
newFileContent:
`foo({
prop001: '',
prop002: '',
prop003: '',
prop004: '',
prop005: '',
prop006: '',
prop007: '',
prop008: '',
prop009: '',
prop010: '',
prop011: '',
prop012: '',
prop013: '',
prop014: '',
prop015: '',
prop016: '',
prop017: '',
prop018: '',
prop019: '',
prop020: '',
});
function foo(arg0: { prop001: string; prop002: string; prop003: string; prop004: string; prop005: string; prop006: string; prop007: string; prop008: string; prop009: string; prop010: string; prop011: string; prop012: string; prop013: string; prop014: string; prop015: string; prop016: string; prop017: string; prop018: string; prop019: string; prop020: string; }) {
throw new Error("Function not implemented.");
}
`,
});
| {
"end_byte": 1391,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingFunctionDeclaration28.ts"
} |
TypeScript/tests/cases/fourslash/referencesForMergedDeclarations4.ts_0_593 | /// <reference path='fourslash.ts'/>
// class and instantiated module
/////*1*/class /*2*/testClass {
//// static staticMethod() { }
//// method() { }
////}
////
/////*3*/module /*4*/testClass {
//// export interface Bar {
////
//// }
//// export var s = 0;
////}
////
////var c1: /*5*/testClass;
////var c2: /*6*/testClass.Bar;
/////*7*/testClass.staticMethod();
/////*8*/testClass.prototype.method();
/////*9*/testClass.bind(this);
/////*10*/testClass.s;
////new /*11*/testClass();
verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11');
| {
"end_byte": 593,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForMergedDeclarations4.ts"
} |
TypeScript/tests/cases/fourslash/unusedClassInNamespace2.ts_0_321 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
//// [| namespace greeter {
//// export class class2 {
//// }
//// class class1 {
//// }
//// } |]
verify.rangeAfterCodeFix(`namespace greeter {
export class class2 {
}
}`, /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 321,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedClassInNamespace2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyImport8.ts_0_467 | /// <reference path="fourslash.ts" />
// @verbatimModuleSyntax: true
// @module: esnext
// @moduleResolution: bundler
// @target: esnext
// @filename: /a.ts
////export function f() {}
// @Filename: /b.ts
////export type * as b from "./a.js";
// @Filename: /c.ts
////import { b } from "./b.js";
goTo.file("/c.ts");
verify.codeFix({
index: 0,
description: ts.Diagnostics.Use_import_type.message,
newFileContent: `import type { b } from "./b.js";`,
});
| {
"end_byte": 467,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixConvertToTypeOnlyImport8.ts"
} |
TypeScript/tests/cases/fourslash/closedCommentsInConstructor.ts_0_152 | /// <reference path="fourslash.ts" />
////class Foo {
//// constructor(/* /**/ */) { }
////}
verify.completions({ marker: "", exact: undefined });
| {
"end_byte": 152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/closedCommentsInConstructor.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnFunctionPropertyReturnedFromGenericFunction3.ts_0_360 | /// <reference path="fourslash.ts" />
//// function createProps<T>(t: T) {
//// const getProps = () => {}
//// const createVariants = () => {}
////
//// getProps.createVariants = createVariants;
//// return getProps;
//// }
////
//// createProps({})./**/createVariants();
verify.quickInfoAt("", "(property) getProps<{}>.createVariants: () => void");
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnFunctionPropertyReturnedFromGenericFunction3.ts"
} |
TypeScript/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts_0_422 | /// <reference path="fourslash.ts" />
// @Filename: /x/src/a.ts
////import {} from "/**/";
// @Filename: /x/tsconfig.json
////{
//// "compilerOptions": {
//// "baseUrl": ".",
//// "paths": {
//// "foo/*": ["src/*"]
//// }
//// }
////}
verify.completions({
marker: "",
exact: ["src", "foo"].map(name => ({ name, kind: "directory" })),
isNewIdentifierLocation: true,
});
| {
"end_byte": 422,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths_pathMapping_topLevel.ts"
} |
TypeScript/tests/cases/fourslash/javaScriptPrototype5.ts_0_441 | ///<reference path="fourslash.ts" />
// No prototype assignments are needed to enable class inference
// @allowNonTsExtensions: true
// @Filename: myMod.js
//// function myCtor() {
//// this.foo = 'hello';
//// this.bar = 10;
//// }
//// let x = new myCtor();
//// x/**/
goTo.marker();
edit.insert('.');
// Check members of the function
verify.completions({ includes: ["foo", "bar"].map(name => ({ name, kind: "property" })) });
| {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptPrototype5.ts"
} |
TypeScript/tests/cases/fourslash/toggleMultilineComment6.ts_0_1242 | // Jsx uses multiline comments for each line commented.
// Selection is outside of a multiline comments inserts multiline comments instead of removing.
// There's some variations between jsx and js comments depending on the position.
//@Filename: file.tsx
//// const var1 = <div>Tex{/*t1</div>;
//// const var2 = <div>Text2[|</div>;
//// const var3 = <div>Tex*/}t3</div>;|]
////
//// [|const var4 = <div>Tex{/*t4</div>;
//// const var5 = <div|]>Text5</div>;
//// const var6 = <div>Tex*/}t6</div>;
////
//// [|const var7 = <div>Tex{/*t7</div>;
//// const var8 = <div>Text8</div>;
//// const var9 = <div>Tex*/}t9</div>;|]
////
//// const var10 = <div>
//// {/*<div>T[|ext</div>*/}
//// <div>Text</div>
//// {/*<div>Text|]</div>*/}
//// </div>;
verify.toggleMultilineComment(
`const var1 = <div>Tex{/*t1</div>;
const var2 = <div>Text2*/}{/*</div>;
const var3 = <div>Tex*/}{/*t3</div>;*/}
/*const var4 = <div>Tex{*//*t4</div>;
const var5 = <div*//*>Text5</div>;
const var6 = <div>Tex*/}t6</div>;
/*const var7 = <div>Tex{*//*t7</div>;
const var8 = <div>Text8</div>;
const var9 = <div>Tex*//*}t9</div>;*/
const var10 = <div>
{/*<div>T*/}{/*ext</div>*/}{/*
<div>Text</div>
*/}{/*<div>Text*/}{/*</div>*/}
</div>;`
); | {
"end_byte": 1242,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleMultilineComment6.ts"
} |
TypeScript/tests/cases/fourslash/formatInTryCatchFinally.ts_0_193 | /// <reference path='fourslash.ts' />
////try
////{
//// var x = 1/*1*/
////}
////catch (e)
////{
////}
goTo.marker("1");
edit.insert(";")
verify.currentLineContentIs(" var x = 1;");
| {
"end_byte": 193,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatInTryCatchFinally.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionAwait2.ts_0_124 | /// <reference path="fourslash.ts" />
//// [|/*start*/await|] Promise.resolve(0);
verify.baselineGoToDefinition("start");
| {
"end_byte": 124,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionAwait2.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts_0_876 | /// <reference path='fourslash.ts' />
// Should not give node module completions if classic module resolution is enabled
// @moduleResolution: classic
// @Filename: dir1/dir2/dir3/dir4/test0.ts
//// import * as foo1 from "f/*import_as0*/
//// import * as foo3 from "fake-module/*import_as1*/
//// import foo4 = require("f/*import_equals0*/
//// import foo6 = require("fake-module/*import_equals1*/
//// var foo7 = require("f/*require0*/
//// var foo9 = require("fake-module/*require1*/
// @Filename: package.json
//// { "dependencies": { "fake-module": "latest" } }
// @Filename: node_modules/fake-module/ts.ts
////
// @Filename: dir1/dir2/dir3/package.json
//// { "dependencies": { "fake-module3": "latest" } }
// @Filename: dir1/dir2/dir3/node_modules/fake-module3/ts.ts
////
verify.completions({ marker: test.markers(), exact: [], isNewIdentifierLocation: true });
| {
"end_byte": 876,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassPropertyInitialization14.ts_0_348 | /// <reference path='fourslash.ts' />
// @strict: true
// @checkJs: true
// @allowJs: true
// @filename: a.js
////class Foo {
//// /** @type {string} */
//// a;
////}
verify.codeFix({
description: `Add 'undefined' type to property 'a'`,
newFileContent:
`class Foo {
/** @type {string | undefined} */
a;
}`,
index: 2
})
| {
"end_byte": 348,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassPropertyInitialization14.ts"
} |
TypeScript/tests/cases/fourslash/completionListInClosedFunction05.ts_3_353 | / <reference path="fourslash.ts" />
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string = "hello", c: typeof x = "hello") {
//// var v = /*1*/
//// }
////}
verify.completions({
marker: "1",
includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"],
isNewIdentifierLocation: true,
});
| {
"end_byte": 353,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInClosedFunction05.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_module_node12.ts_0_478 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @module: node16
// @Filename: /a.js
////module.exports = 0;
// @Filename: /b.ts
////module.exports = 0;
// @Filename: /c.cjs
////module.exports = 0;
// @Filename: /d.cts
////module.exports = 0;
goTo.file("/a.js");
verify.codeFixAvailable([]);
goTo.file("/b.ts");
verify.codeFixAvailable([]);
goTo.file("/c.cjs");
verify.codeFixAvailable([]);
goTo.file("/d.cts");
verify.codeFixAvailable([]); | {
"end_byte": 478,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_module_node12.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts_0_367 | /// <reference path='fourslash.ts' />
////abstract class A {
//// abstract f(): this;
////}
////
////class C extends A {}
verify.codeFix({
description: "Implement inherited abstract class",
newFileContent:
`abstract class A {
abstract f(): this;
}
class C extends A {
f(): this {
throw new Error("Method not implemented.");
}
}`
});
| {
"end_byte": 367,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassExtendAbstractMethodThis.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedSpreadExpression01.ts_0_129 | /// <reference path='fourslash.ts' />
////var x;
////var y = [1,2,.../*1*/
verify.completions({ marker: "1", includes: "x" });
| {
"end_byte": 129,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedSpreadExpression01.ts"
} |
TypeScript/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts_0_835 | /// <reference path='fourslash.ts' />
////interface MultiRobot {
//// name: string;
//// skills: {
//// [|[|{| "contextRangeIndex": 0 |}primary|]: string;|]
//// secondary: string;
//// };
////}
////let multiRobot: MultiRobot, [|[|{| "contextRangeIndex": 2 |}primary|]: string|], secondary: string, primaryA: string, secondaryA: string, i: number;
////for ([|{ skills: { [|{| "contextRangeIndex": 4 |}primary|]: primaryA, secondary: secondaryA } } = multiRobot|], i = 0; i < 1; i++) {
//// primaryA;
////}
////for ([|{ skills: { [|{| "contextRangeIndex": 6 |}primary|], secondary } } = multiRobot|], i = 0; i < 1; i++) {
//// [|primary|];
////}
verify.noErrors();
const ranges = test.ranges();
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = ranges;
verify.baselineRename([r0, r2, r1, r3, r4]);
| {
"end_byte": 835,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDestructuringAssignmentNestedInFor2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageCallJS.ts_0_369 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: test.js
////function wat(b) {
//// b();
////}
verify.codeFix({
index: 0,
description: ignoreInterpolations(ts.Diagnostics.Infer_parameter_types_from_usage),
newFileContent:
`/**
* @param {() => void} b
*/
function wat(b) {
b();
}`});
| {
"end_byte": 369,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageCallJS.ts"
} |
TypeScript/tests/cases/fourslash/jsdocDeprecated_suggestion9.ts_0_250 | ///<reference path="fourslash.ts" />
// @Filename: first.ts
//// export class logger { }
// @Filename: second.ts
//// import { logger } from './first';
//// new logger()
goTo.file('second.ts')
verify.noErrors()
verify.getSuggestionDiagnostics([]);
| {
"end_byte": 250,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocDeprecated_suggestion9.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts_0_1017 | /// <reference path='fourslash.ts' />
// @target: esnext
// @lib: es2015
// @strict: true
// @allowJS: true
// @checkJS: true
// @filename: main.js
////const p1 = new Promise(resolve => resolve());
////const p2 = /** @type {Promise<number>} */(new Promise(resolve => resolve()));
////const p3 = /** @type {Promise<number | string>} */(new Promise(resolve => resolve()));
////const p4 = /** @type {Promise<{ x: number } & { y: string }>} */(new Promise(resolve => resolve()));
verify.codeFixAll({
fixId: "addVoidToPromise",
fixAllDescription: ts.Diagnostics.Add_void_to_all_Promises_resolved_without_a_value.message,
newFileContent: `const p1 = /** @type {Promise<void>} */(new Promise(resolve => resolve()));
const p2 = /** @type {Promise<number | void>} */(new Promise(resolve => resolve()));
const p3 = /** @type {Promise<number | string | void>} */(new Promise(resolve => resolve()));
const p4 = /** @type {Promise<({ x: number } & { y: string }) | void>} */(new Promise(resolve => resolve()));`
});
| {
"end_byte": 1017,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddVoidToPromiseJS_all.ts"
} |
TypeScript/tests/cases/fourslash/extractSuperOutsideClass.ts_0_133 | /// <reference path='fourslash.ts' />
/////*a*/super()/*b*/
goTo.select("a", "b");
verify.not.refactorAvailable("Extract Symbol");
| {
"end_byte": 133,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extractSuperOutsideClass.ts"
} |
TypeScript/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts_0_377 | /// <reference path="fourslash.ts" />
// @strict: true
////
//// interface Func {
//// <Key extends "a" | "b">(
//// ...args:
//// | [key: Key, options?: any]
//// | [key: Key, defaultValue: string, options?: any]
//// ): string;
//// }
////
//// declare const func: Func;
////
//// func("/*1*/");
verify.completions({ marker: ["1"], exact: [`a`, `b`] });
| {
"end_byte": 377,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsLiteralDirectlyInRestConstrainedToTupleType.ts"
} |
TypeScript/tests/cases/fourslash/gotoDefinitionLinkTag3.ts_0_227 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////enum E {
//// /** {@link /*1*/[|Foo|]} */
//// Foo
////}
////interface [|/*2*/Foo|] {
//// foo: E.Foo;
////}
verify.baselineGetDefinitionAtPosition("1");
| {
"end_byte": 227,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/gotoDefinitionLinkTag3.ts"
} |
TypeScript/tests/cases/fourslash/convertFunctionToEs6Class-prototypeAccessor.ts_0_531 | // @allowNonTsExtensions: true
// @Filename: test123.js
/// <reference path="./fourslash.ts" />
//// // Comment
//// function /*1*/fn() {
//// this.baz = 10;
//// }
//// fn.prototype = {
//// /** JSDoc */
//// get bar() {
//// return this.baz;
//// }
//// }
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`// Comment
class fn {
constructor() {
this.baz = 10;
}
/** JSDoc */
get bar() {
return this.baz;
}
}
`,
});
| {
"end_byte": 531,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/convertFunctionToEs6Class-prototypeAccessor.ts"
} |
TypeScript/tests/cases/fourslash/extract-method_jsxElement3.ts_0_795 | /// <reference path='fourslash.ts' />
// @jsx: preserve
// @filename: a.tsx
////declare var React: any;
////class Foo extends React.Component<{}, {}> {
//// render() {
//// return (
//// <div>
//// /*a*/<span></span>/*b*/
//// </div>
//// );
//// }
////}
goTo.file("a.tsx");
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to method in class 'Foo'",
newContent:
`declare var React: any;
class Foo extends React.Component<{}, {}> {
render() {
return (
<div>
{this./*RENAME*/newMethod()}
</div>
);
}
private newMethod() {
return <span></span>;
}
}`
});
| {
"end_byte": 795,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method_jsxElement3.ts"
} |
TypeScript/tests/cases/fourslash/regexDetection.ts_0_395 | /// <reference path="fourslash.ts" />
//// /*1*/15 / /*2*/Math.min(61 / /*3*/42, 32 / 15) / /*4*/15;
goTo.marker("1");
verify.not.quickInfoExists();
goTo.marker("2");
verify.quickInfoIs("var Math: Math",
"An intrinsic object that provides basic mathematics functionality and constants.");
goTo.marker("3");
verify.not.quickInfoExists();
goTo.marker("4");
verify.not.quickInfoExists();
| {
"end_byte": 395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/regexDetection.ts"
} |
TypeScript/tests/cases/fourslash/extract-const3.ts_0_409 | /// <reference path='fourslash.ts' />
// GH#35372
////function foo(bar?: number) {
//// /*a*/bar?.toString();/*b*/
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "constant_scope_0",
actionDescription: "Extract to constant in enclosing scope",
newContent:
`function foo(bar?: number) {
const /*RENAME*/newLocal = bar?.toString();
}`
});
| {
"end_byte": 409,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-const3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingProperties5.ts_0_263 | /// <reference path='fourslash.ts' />
////type T = {
//// a: null;
////}
////
////[|const foo: T = {}|];
verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent:
`const foo: T = {
a: null
}`
});
| {
"end_byte": 263,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingProperties5.ts"
} |
TypeScript/tests/cases/fourslash/stringBraceCompletionPosition.ts_3_333 | / <reference path="fourslash.ts" />
//// var x = "/*1*/";
//// var x = '/*2*/';
//// var x = "hello \
//// /*3*/";
goTo.marker('1');
verify.not.isValidBraceCompletionAtPosition('(');
goTo.marker('2');
verify.not.isValidBraceCompletionAtPosition('(');
goTo.marker('3');
verify.not.isValidBraceCompletionAtPosition('(');
| {
"end_byte": 333,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/stringBraceCompletionPosition.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts_0_382 | /// <reference path="fourslash.ts" />
//// [|foo/*0*/();|]
// @Filename: folder_a/f2.ts
//// export function foo() {};
// @Filename: tsconfig.json
//// {
//// "compilerOptions": {
//// "baseUrl": ".",
//// "paths": {
//// "a": [ "folder_a/f2" ]
//// }
//// }
//// }
verify.importFixAtPosition([
`import { foo } from "a";
foo();`
]);
| {
"end_byte": 382,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportPaths0.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionImportedNames4.ts_0_360 | /// <reference path='fourslash.ts' />
// @Filename: b.ts
////import {Class as [|/*classAliasDefinition*/ClassAlias|]} from "./a";
// @Filename: a.ts
////export module Module {
////}
////export class /*classDefinition*/Class {
//// private f;
////}
////export interface Interface {
//// x;
////}
verify.baselineGoToDefinition("classAliasDefinition");
| {
"end_byte": 360,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionImportedNames4.ts"
} |
TypeScript/tests/cases/fourslash/linkedEditingJsxTag7.ts_0_1702 | /// <reference path='fourslash.ts' />
// plaintext
// const jsx = (
// <>
// <img />
// </>
// );
// const jsx2 = (
// /* this is comment */</* more comment */>Hello
// </ /* even more comment */>
// );
// const jsx3 = (
// <>
// </>
// );
// @FileName: /fragment.tsx
/////*a*/const j/*b*/sx =/*c*/ (
//// /*5*/</*0*/>/*1*/
//// <img />
//// /*6*/</*2*///*3*/>/*4*/
////)/*d*/;
////const jsx2 = (
//// /* this is comment *//*13*/</*10*//* /*11*/more comment *//*12*/>/*8*/Hello/*9*/
//// <//*14*/ /*18*///*17*/* even/*15*/ more comment *//*16*/>
////);
////const jsx3 = (
//// <>/*7*/
//// </>
////);/*e*/
const wordPattern = "[a-zA-Z0-9:\\-\\._$]*";
const startPos1 = test.markerByName("0").position;
const endPos1 = test.markerByName("3").position;
const linkedCursors1 = {
ranges: [{ start: startPos1, length: 0 }, { start: endPos1, length: 0 }],
wordPattern,
};
const startPos2 = test.markerByName("10").position;
const endPos2 = test.markerByName("14").position;
const linkedCursors2 = {
ranges: [{ start: startPos2, length: 0 }, { start: endPos2, length: 0 }],
wordPattern,
};
verify.linkedEditing({
"0": linkedCursors1,
"1": undefined,
"2": undefined,
"3": linkedCursors1,
"4": undefined,
"5": undefined,
"6": undefined,
"7": undefined,
"8": undefined,
"9": undefined,
"10": linkedCursors2,
"11": undefined,
"12": undefined,
"13": undefined,
"14": linkedCursors2,
"15": undefined,
"16": undefined,
"17": undefined,
"18": undefined,
"a": undefined,
"b": undefined,
"c": undefined,
"d": undefined,
"e": undefined,
}); | {
"end_byte": 1702,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/linkedEditingJsxTag7.ts"
} |
TypeScript/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_nested.ts_0_292 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @noUnusedParameters: true
////export {};
////const { x: { a, b } } = o;
verify.codeFix({
description: ts.Diagnostics.Remove_unused_destructuring_declaration.message,
newFileContent:
`export {};
const { } = o;`,
});
| {
"end_byte": 292,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixUnusedIdentifier_destructure_allUnused_nested.ts"
} |
TypeScript/tests/cases/fourslash/tsxFindAllReferences1.ts_0_400 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// /*1*/div: {
//// name?: string;
//// isOpen?: boolean;
//// };
//// span: { n: string; };
//// }
//// }
//// var x = /*2*/</*3*/div />;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 400,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxFindAllReferences1.ts"
} |
TypeScript/tests/cases/fourslash/indentationInJsx3.ts_0_447 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
////function foo() {
//// return (
//// <div>
////hello
////goodbye
//// </div>
//// )
////}
verify.currentFileContentIs(
`function foo() {
return (
<div>
hello
goodbye
</div>
)
}`
);
format.document();
verify.currentFileContentIs(
`function foo() {
return (
<div>
hello
goodbye
</div>
)
}`
); | {
"end_byte": 447,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/indentationInJsx3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingCallParentheses3.ts_0_636 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
////function foo() {
//// const x = {
//// foo: {
//// bar() { return true; }
//// }
//// }
//// x.foo.bar/**/ ? console.log('test') : undefined;
////}
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; }
}
}
x.foo.bar() ? console.log('test') : undefined;
}`,
});
| {
"end_byte": 636,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingCallParentheses3.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesLoopBreakContinueNegatives.ts_0_1906 | /// <reference path='fourslash.ts' />
////var arr = [1, 2, 3, 4];
////label1: for (var n in arr) {
//// break;
//// continue;
//// break label1;
//// continue label1;
////
//// label2: for (var i = 0; i < arr[n]; i++) {
//// break label1;
//// continue label1;
////
//// break;
//// continue;
//// break label2;
//// continue label2;
////
//// function foo() {
//// label3: while (true) {
//// break;
//// continue;
//// break label3;
//// continue label3;
////
//// // these cross function boundaries
//// br/*1*/eak label1;
//// cont/*2*/inue label1;
//// bre/*3*/ak label2;
//// c/*4*/ontinue label2;
////
//// label4: do {
//// break;
//// continue;
//// break label4;
//// continue label4;
////
//// break label3;
//// continue label3;
////
//// switch (10) {
//// case 1:
//// case 2:
//// break;
//// break label4;
//// default:
//// continue;
//// }
////
//// // these cross function boundaries
//// br/*5*/eak label1;
//// co/*6*/ntinue label1;
//// br/*7*/eak label2;
//// con/*8*/tinue label2;
//// () => { b/*9*/reak; }
//// } while (true)
//// }
//// }
//// }
////}
////
////label5: while (true) break label5;
////
////label7: while (true) co/*10*/ntinue label5;
verify.baselineDocumentHighlights(test.markers());
| {
"end_byte": 1906,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesLoopBreakContinueNegatives.ts"
} |
TypeScript/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_functions.ts_0_187 | /// <reference path='fourslash.ts' />
////var aa = 1;
////function /*functionName1*/
////function a/*functionName2*/
verify.completions({ marker: test.markers(), exact: undefined });
| {
"end_byte": 187,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_functions.ts"
} |
TypeScript/tests/cases/fourslash/unusedLocalsInFunction4.ts_0_256 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////function greeter() {
//// [| var x,y = 0,z = 1; |]
//// use(y, z);
////}
verify.rangeAfterCodeFix("var y = 0,z = 1;", /*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 256,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedLocalsInFunction4.ts"
} |
TypeScript/tests/cases/fourslash/completionListInEmptyFile.ts_0_114 | /// <reference path="fourslash.ts"/>
////var a = 0;
/////**/
verify.completions({ marker: "", includes: "a" });
| {
"end_byte": 114,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInEmptyFile.ts"
} |
TypeScript/tests/cases/fourslash/extract-method-empty-namespace.ts_0_404 | /// <reference path='fourslash.ts' />
////function f() {
//// /*start*/namespace N {}/*end*/
////}
goTo.select('start', 'end')
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_1",
actionDescription: "Extract to function in global scope",
newContent: `function f() {
/*RENAME*/newFunction();
}
function newFunction() {
namespace N { }
}
`
});
| {
"end_byte": 404,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method-empty-namespace.ts"
} |
TypeScript/tests/cases/fourslash/parameterlessSetter.ts_0_273 | /// <reference path="fourslash.ts" />
//// class foo {
//// get getterOnly() {
//// return undefined;
//// }
//// set setterOnly() { }
//// }
//// var obj = new foo();
//// obj.setterOnly = obj./**/getterOnly;
goTo.marker();
verify.quickInfoExists();
| {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/parameterlessSetter.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesExport1.ts_0_1444 | /// <reference path='fourslash.ts' />
////module m {
//// [|export|] class C1 {
//// public pub1;
//// public pub2;
//// private priv1;
//// private priv2;
//// protected prot1;
//// protected prot2;
////
//// public public;
//// private private;
//// protected protected;
////
//// public constructor(public a, private b, protected c, public d, private e, protected f) {
//// this.public = 10;
//// this.private = 10;
//// this.protected = 10;
//// }
////
//// public get x() { return 10; }
//// public set x(value) { }
////
//// public static statPub;
//// private static statPriv;
//// protected static statProt;
//// }
////
//// [|export|] interface I1 {
//// }
////
//// [|export|] declare module ma.m1.m2.m3 {
//// interface I2 {
//// }
//// }
////
//// [|export|] module mb.m1.m2.m3 {
//// declare var foo;
////
//// export class C2 {
//// public pub1;
//// private priv1;
//// protected prot1;
////
//// protected constructor(public public, protected protected, private private) {
//// }
//// }
//// }
////
//// declare var ambientThing: number;
//// [|export|] var exportedThing = 10;
//// declare function foo(): string;
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 1444,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesExport1.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts_0_2152 | /// <reference path="fourslash.ts"/>
////class List<T> {
//// constructor(public a: boolean, private b: T, readonly c: string, d: number) {
//// var local = 0;
//// }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "List",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor",
"childItems": [
{
"text": "local",
"kind": "var"
}
]
},
{
"text": "a",
"kind": "property",
"kindModifiers": "public"
},
{
"text": "b",
"kind": "property",
"kindModifiers": "private"
},
{
"text": "c",
"kind": "property"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "List",
"kind": "class"
}
]
},
{
"text": "List",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "a",
"kind": "property",
"kindModifiers": "public"
},
{
"text": "b",
"kind": "property",
"kindModifiers": "private"
},
{
"text": "c",
"kind": "property"
}
],
"indent": 1
},
{
"text": "constructor",
"kind": "constructor",
"childItems": [
{
"text": "local",
"kind": "var"
}
],
"indent": 2
}
]);
| {
"end_byte": 2152,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsPropertiesDefinedInConstructors.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnThis.ts_0_839 | /// <reference path='fourslash.ts' />
////interface Restricted {
//// n: number;
////}
////function wrapper(wrapped: { (): void; }) { }
////class Foo {
//// n: number;
//// prop1: th/*0*/is;
//// public explicitThis(this: this) {
//// wrapper(
//// function explicitVoid(this: void) {
//// console.log(th/*1*/is);
//// }
//// )
//// console.log(th/*2*/is);
//// }
//// public explicitInterface(th/*3*/is: Restricted) {
//// console.log(th/*4*/is);
//// }
//// public explicitClass(th/*5*/is: Foo) {
//// console.log(th/*6*/is);
//// }
////}
verify.quickInfos({
0: "this",
1: "this: void",
2: "this: this",
3: "(parameter) this: Restricted",
4: "this: Restricted",
5: "(parameter) this: Foo",
6: "this: Foo"
});
| {
"end_byte": 839,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnThis.ts"
} |
TypeScript/tests/cases/fourslash/completionAtDottedNamespace.ts_0_142 | /// <reference path='fourslash.ts'/>
////namespace wwer./**/w
verify.completions({ marker: "", exact: [], isNewIdentifierLocation: true });
| {
"end_byte": 142,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionAtDottedNamespace.ts"
} |
TypeScript/tests/cases/fourslash/javaScriptClass3.ts_0_456 | ///<reference path="fourslash.ts" />
// In an inferred class, we can go-to-def successfully
// @allowNonTsExtensions: true
// @Filename: Foo.js
//// class Foo {
//// constructor() {
//// this./*dst1*/alpha = 10;
//// this./*dst2*/beta = 'gamma';
//// }
//// method() { return this.alpha; }
//// }
//// var x = new Foo();
//// x.[|alpha/*src1*/|];
//// x.[|beta/*src2*/|];
verify.baselineGoToDefinition(
"src1",
"src2",
);
| {
"end_byte": 456,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptClass3.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingSuperCall.ts_0_395 | /// <reference path='fourslash.ts' />
////class A {}
////class B extends A {
//// [|constructor|]() {}
////}
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_missing_super_call.message }
])
verify.codeFix({
description: ts.Diagnostics.Add_missing_super_call.message,
newFileContent:
`class A {}
class B extends A {
constructor() {
super();
}
}`
});
| {
"end_byte": 395,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingSuperCall.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionOverriddenMember16.ts_0_350 | /// <reference path="fourslash.ts" />
// @Filename: goToDefinitionOverrideJsdoc.ts
// @allowJs: true
// @checkJs: true
//// export class C extends CompletelyUndefined {
//// /**
//// * @override/*1*/
//// * @returns {{}}
//// */
//// static foo() {
//// return {}
//// }
//// }
verify.baselineGoToDefinition('1')
| {
"end_byte": 350,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverriddenMember16.ts"
} |
TypeScript/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern.ts_0_795 | /// <reference path='fourslash.ts' />
////declare var console: {
//// log(msg: any): void;
////}
////type Robot = [number, string, string];
////var robotA: Robot = [1, "mower", "mowing"];
////function foo1([, nameA]: Robot) {
//// console.log(nameA);
////}
////function foo2([numberB]: Robot) {
//// console.log(numberB);
////}
////function foo3([numberA2, nameA2, skillA2]: Robot) {
//// console.log(nameA2);
////}
////function foo4([numberA3, ...robotAInfo]: Robot) {
//// console.log(robotAInfo);
////}
////foo1(robotA);
////foo1([2, "trimmer", "trimming"]);
////foo2(robotA);
////foo2([2, "trimmer", "trimming"]);
////foo3(robotA);
////foo3([2, "trimmer", "trimming"]);
////foo4(robotA);
////foo4([2, "trimmer", "trimming"]);
verify.baselineCurrentFileBreakpointLocations(); | {
"end_byte": 795,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/breakpointValidationDestructuringParameterArrayBindingPattern.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionShadowVariable.ts_0_298 | /// <reference path='fourslash.ts' />
////var shadowVariable = "foo";
////function shadowVariableTestModule() {
//// var /*shadowVariableDefinition*/shadowVariable;
//// /*shadowVariableReference*/shadowVariable = 1;
////}
verify.baselineGetDefinitionAtPosition("shadowVariableReference");
| {
"end_byte": 298,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionShadowVariable.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts_0_196 | /// <reference path='fourslash.ts'/>
////class Foo {
//// /*1*/public /*2*/__bar() { return 0; }
////}
////
////var x: Foo;
////x./*3*/__bar;
verify.baselineFindAllReferences('1', '2', '3');
| {
"end_byte": 196,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts"
} |
TypeScript/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts_0_402 | /// <reference path='fourslash.ts' />
////abstract class A<T> {
//// abstract f(x: T): T;
////}
////
////class C extends A<number> {}
verify.codeFix({
description: "Implement inherited abstract class",
newFileContent:
`abstract class A<T> {
abstract f(x: T): T;
}
class C extends A<number> {
f(x: number): number {
throw new Error("Method not implemented.");
}
}`
});
| {
"end_byte": 402,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixClassExtendAbstractMethodTypeParamsInstantiateNumber.ts"
} |
TypeScript/tests/cases/fourslash/failureToImplementClass.ts_0_262 | /// <reference path="fourslash.ts" />
////interface IExec {
//// exec: (filename: string, cmdLine: string) => boolean;
////}
////class /*1*/NodeExec/*2*/ implements IExec { }
verify.errorExistsBetweenMarkers("1", "2");
verify.numberOfErrorsInCurrentFile(1); | {
"end_byte": 262,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/failureToImplementClass.ts"
} |
TypeScript/tests/cases/fourslash/codeFixImportNonExportedMember5.ts_0_282 | /// <reference path="fourslash.ts" />
// @moduleResolution: node
// @module: esnext
// @filename: /node_modules/foo/index.js
////function bar() {}
// @filename: /b.ts
////import { bar } from "./foo";
goTo.file("/b.ts");
verify.not.codeFixAvailable("fixImportNonExportedMember");
| {
"end_byte": 282,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixImportNonExportedMember5.ts"
} |
TypeScript/tests/cases/fourslash/importTypeCompletions5.ts_0_656 | /// <reference path="fourslash.ts" />
// @esModuleInterop: false
// @Filename: /foo.ts
////interface Foo { };
////export = Foo;
// @Filename: /bar.ts
//// [|import type f/**/|]
goTo.file("/bar.ts")
verify.completions({
marker: "",
exact: [{
name: "Foo",
sourceDisplay: "./foo",
source: "./foo",
insertText: "import type Foo = require(\"./foo\");",
replacementSpan: test.ranges()[0]
}],
isNewIdentifierLocation: true,
preferences: {
includeCompletionsForModuleExports: true,
includeCompletionsForImportStatements: true,
includeCompletionsWithInsertText: true
}
});
| {
"end_byte": 656,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importTypeCompletions5.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionShorthandProperty02.ts_0_117 | /// <reference path='fourslash.ts' />
////let x = {
//// [|f/*1*/oo|]
////}
verify.baselineGoToDefinition("1");
| {
"end_byte": 117,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionShorthandProperty02.ts"
} |
TypeScript/tests/cases/fourslash/completionsWithOptionalPropertiesGenericPartial2.ts_0_446 | /// <reference path="fourslash.ts" />
// @strict: true
//// interface Foo {
//// a: boolean;
//// }
//// function partialFoo<T extends Partial<Foo>>(x: T, y: T) {return t}
//// partialFoo({ a: true, b: true }, { /*1*/ });
verify.completions({
marker: '1',
includes: [
{
sortText: completion.SortText.OptionalMember,
name: 'a'
},
{
sortText: completion.SortText.OptionalMember,
name: 'b'
}
]
})
| {
"end_byte": 446,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsWithOptionalPropertiesGenericPartial2.ts"
} |
TypeScript/tests/cases/fourslash/jsdocSatisfiesTagCompletion1.ts_0_252 | ///<reference path="fourslash.ts" />
// @noEmit: true
// @allowJS: true
// @checkJs: true
// @filename: /a.js
/////**
//// * @satisfies {/**/}
//// */
////const t = { a: 1 };
verify.completions(
{ marker: "", exact: completion.globalTypes },
);
| {
"end_byte": 252,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsdocSatisfiesTagCompletion1.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoOnJsxNamespacedName.ts_0_273 | /// <reference path="fourslash.ts" />
// @jsx: react
// @Filename: /types.d.ts
////declare namespace JSX {
//// interface IntrinsicElements { ['a:b']: { a: string }; }
////}
// @filename: /a.tsx
////</**/a:b a="accepted" b="rejected" />;
verify.baselineQuickInfo();
| {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoOnJsxNamespacedName.ts"
} |
TypeScript/tests/cases/fourslash/autoImportFileExcludePatterns13.ts_0_1013 | /// <reference path="fourslash.ts" />
// @Filename: /src/vs/test.ts
//// import { Parts } from './parts';
//// export class /**/Extended implements Parts {
//// }
// @Filename: /src/vs/parts.ts
//// import { Event } from '../event/event';
////
//// export interface Parts {
//// readonly options: Event;
//// }
// @Filename: /src/event/event.ts
//// export interface Event {
//// (): string;
//// }
// @Filename: /src/thing.ts
//// import { Event } from '../event/event';
//// export { Event };
// @Filename: /src/a.ts
//// import './thing'
//// declare module './thing' {
//// interface Event {
//// c: string;
//// }
//// }
// In this test, `Event` is incorrectly imported in `thing.ts`
verify.codeFix({
description: "Implement interface 'Parts'",
newFileContent:
`import { Event } from '../event/event';
import { Parts } from './parts';
export class Extended implements Parts {
options: Event;
}`,
preferences: {
autoImportFileExcludePatterns: ["src/thing.ts"],
}
});
| {
"end_byte": 1013,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportFileExcludePatterns13.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral_quotePreference6.ts_0_281 | /// <reference path='fourslash.ts'/>
////type T = "0" | "1";
////const t: T = /**/
verify.completions({
marker: "",
includes: [
{ name: '"1"' },
{ name: '"0"' },
],
isNewIdentifierLocation: true,
preferences: { quotePreference: "double" }
});
| {
"end_byte": 281,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral_quotePreference6.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpInAdjacentBlockBody.ts_0_286 | /// <reference path="fourslash.ts" />
////declare function foo(...args);
////
////foo(() => {/*1*/}/*2*/)
goTo.marker("1");
verify.signatureHelpPresentForTriggerReason({
kind: "invoked",
});
goTo.marker("2");
verify.signatureHelpPresentForTriggerReason({
kind: "invoked",
}); | {
"end_byte": 286,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpInAdjacentBlockBody.ts"
} |
TypeScript/tests/cases/fourslash/renameDestructuringClassProperty.ts_0_610 | /// <reference path='fourslash.ts' />
////class A {
//// [|[|{| "contextRangeIndex": 0 |}foo|]: string;|]
////}
////class B {
//// syntax1(a: A): void {
//// [|let { [|{| "contextRangeIndex": 2 |}foo|] } = a;|]
//// }
//// syntax2(a: A): void {
//// [|let { [|{| "contextRangeIndex": 4 |}foo|]: foo } = a;|]
//// }
//// syntax11(a: A): void {
//// [|let { [|{| "contextRangeIndex": 6 |}foo|] } = a;|]
//// [|foo|] = "newString";
//// }
////}
const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3, r4] = test.ranges();
verify.baselineRename([r0, r2, r1, r3, r4]);
| {
"end_byte": 610,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameDestructuringClassProperty.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpellingJs7.ts_0_1265 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @noEmit: true
// @filename: spellingUncheckedJS.js
//// // @ts-nocheck
//// export var inModule = 1
//// inmodule.toFixed()
////
//// function f() {
//// var locals = 2 + true
//// locale.toFixed()
//// }
//// class Classe {
//// non = 'oui'
//// methode() {
//// // no error on 'this' references
//// return this.none
//// }
//// }
//// class Derivee extends Classe {
//// methode() {
//// // no error on 'super' references
//// return super.none
//// }
//// }
////
////
//// var object = {
//// spaaace: 3
//// }
//// object.spaaaace // error on read
//// object.spaace = 12 // error on write
//// object.fresh = 12 // OK
//// other.puuuce // OK, from another file
//// new Date().getGMTDate() // OK, from another file
////
//// // No suggestions for globals from other files
//// const atoc = setIntegral(() => console.log('ok'), 500)
//// AudioBuffin // etc
//// Jimmy
//// Jon
//// window.argle
//// self.blargle
// @filename: other.js
//// // @ts-nocheck
//// var Jimmy = 1
//// var John = 2
//// Jon // error, it's from the same file
//// var other = {
//// puuce: 4
//// }
//// window.argle
//// self.blargle
verify.noErrors()
| {
"end_byte": 1265,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingJs7.ts"
} |
TypeScript/tests/cases/fourslash/autoImportNoPackageJson_commonjs.ts_0_270 | /// <reference path="fourslash.ts" />
// @module: commonjs
// @Filename: /node_modules/lit/index.d.cts
//// export declare function customElement(name: string): any;
// @Filename: /a.ts
//// customElement/**/
verify.importFixModuleSpecifiers("", ["lit/index.cjs"]);
| {
"end_byte": 270,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportNoPackageJson_commonjs.ts"
} |
TypeScript/tests/cases/fourslash/docCommentTemplateIndentation.ts_0_338 | /// <reference path='fourslash.ts' />
// @Filename: indents.ts
//// a /*2*/
//// /*1*/
/////*0*/ function foo() { }
const singleLineComment = "/** */";
verify.docCommentTemplateAt("0", 3, singleLineComment);
verify.docCommentTemplateAt("1", 3, singleLineComment);
verify.docCommentTemplateAt("2", 3, singleLineComment);
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/docCommentTemplateIndentation.ts"
} |
TypeScript/tests/cases/fourslash/unusedImports5FS.ts_0_468 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
// @Filename: file2.ts
//// [| import {Calculator, test, test2} from "./file1" |]
////
//// var x = new Calculator();
//// x.handleChar();
//// test();
// @Filename: file1.ts
//// export class Calculator {
//// handleChar() {}
//// }
////
//// export function test() {
////
//// }
////
//// export function test2() {
////
//// }
verify.rangeAfterCodeFix(`import {Calculator, test} from "./file1"`); | {
"end_byte": 468,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedImports5FS.ts"
} |
TypeScript/tests/cases/fourslash/annotateWithTypeFromJSDoc17.ts_0_405 | /// <reference path='fourslash.ts' />
////class C {
//// /**
//// * @param {number} x - the first parameter
//// */
//// constructor(readonly x) {
//// }
////}
verify.codeFix({
description: "Annotate with type from JSDoc",
index: 0,
newFileContent:
`class C {
/**
* @param {number} x - the first parameter
*/
constructor(readonly x: number) {
}
}`,
});
| {
"end_byte": 405,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/annotateWithTypeFromJSDoc17.ts"
} |
TypeScript/tests/cases/fourslash/toggleLineComment2.ts_0_516 | // When indentation is different between lines it should get the left most indentation
// and use that for all lines.
// When uncommeting, doesn't matter what indentation the line has.
//// let var1[| = 1;
//// let var2 = 2;
//// let var3 |]= 3;
////
//// // let var4[| = 1;
//// //let var5 = 2;
//// // let var6 |]= 3;
verify.toggleLineComment(
` // let var1 = 1;
//let var2 = 2;
// let var3 = 3;
let var4 = 1;
let var5 = 2;
let var6 = 3;`); | {
"end_byte": 516,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/toggleLineComment2.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsImports.ts_0_1831 | /// <reference path="fourslash.ts"/>
////import d1 from "a";
////
////import { a } from "a";
////
////import { b as B } from "a"
////
////import d2, { c, d as D } from "a"
////
////import e = require("a");
////
////import * as ns from "a";
verify.navigationTree({
"text": "\"navigationBarItemsImports\"",
"kind": "module",
"childItems": [
{
"text": "a",
"kind": "alias"
},
{
"text": "B",
"kind": "alias"
},
{
"text": "c",
"kind": "alias"
},
{
"text": "D",
"kind": "alias"
},
{
"text": "d1",
"kind": "alias"
},
{
"text": "d2",
"kind": "alias"
},
{
"text": "e",
"kind": "alias"
},
{
"text": "ns",
"kind": "alias"
}
]
});
verify.navigationBar([
{
"text": "\"navigationBarItemsImports\"",
"kind": "module",
"childItems": [
{
"text": "a",
"kind": "alias"
},
{
"text": "B",
"kind": "alias"
},
{
"text": "c",
"kind": "alias"
},
{
"text": "D",
"kind": "alias"
},
{
"text": "d1",
"kind": "alias"
},
{
"text": "d2",
"kind": "alias"
},
{
"text": "e",
"kind": "alias"
},
{
"text": "ns",
"kind": "alias"
}
]
}
]);
| {
"end_byte": 1831,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsImports.ts"
} |
TypeScript/tests/cases/fourslash/completionsClassMemberImportTypeNodeParameter1.ts_0_979 | /// <reference path="fourslash.ts" />
// @module: nodenext
// @Filename: /generation.d.ts
//// export type GenerationConfigType = { max_length?: number };
// @FileName: /index.d.ts
//// export declare class PreTrainedModel {
//// _get_generation_config(
//// param: import("./generation.js").GenerationConfigType,
//// ): import("./generation.js").GenerationConfigType;
//// }
////
//// export declare class BlenderbotSmallPreTrainedModel extends PreTrainedModel {
//// /*1*/
//// }
verify.completions({
marker: "1",
includes: [
{
name: "_get_generation_config",
insertText: `_get_generation_config(param: import("./generation.js").GenerationConfigType): import("./generation.js").GenerationConfigType;`,
filterText: "_get_generation_config",
hasAction: undefined,
},
],
preferences: {
includeCompletionsWithClassMemberSnippets: true,
includeCompletionsWithInsertText: true,
},
isNewIdentifierLocation: true,
});
| {
"end_byte": 979,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsClassMemberImportTypeNodeParameter1.ts"
} |
TypeScript/tests/cases/fourslash/formatSelectionPreserveTrailingWhitespace.ts_0_245 | /// <reference path="fourslash.ts" />
////
/////*begin*/;
////
/////*end*/
////
////
format.setOption("trimTrailingWhitespace", false);
format.selection('begin', 'end');
verify.currentFileContentIs(`
;
`);
| {
"end_byte": 245,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatSelectionPreserveTrailingWhitespace.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteral5.ts_0_232 | /// <reference path='fourslash.ts'/>
////interface Foo {
//// foo: string;
//// bar: string;
////}
////
////function f<K extends keyof Foo>(a: K) { };
////f("/*1*/
verify.completions({ marker: "1", exact: ["foo", "bar"] });
| {
"end_byte": 232,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteral5.ts"
} |
TypeScript/tests/cases/fourslash/callHierarchyFunctionAmbiguity.4.ts_0_338 | /// <reference path="fourslash.ts" />
// @filename: a.d.ts
//// declare function foo(x?: number): void;
// @filename: b.d.ts
//// declare function foo(x?: string): void;
//// declare function /**/foo(x?: boolean): void;
// @filename: main.ts
//// function bar() {
//// foo();
//// }
goTo.marker();
verify.baselineCallHierarchy();
| {
"end_byte": 338,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/callHierarchyFunctionAmbiguity.4.ts"
} |
TypeScript/tests/cases/fourslash/javaScriptModules14.ts_0_597 | ///<reference path="fourslash.ts" />
// Assignments to 'exports.p' stop global variables from being visible in other files
// @allowJs: true
// @Filename: myMod.js
//// if (true) {
//// exports.b = true;
//// } else {
//// exports.n = 3;
//// }
//// function fn() {
//// exports.s = 'foo';
//// }
//// var invisible = true;
// @Filename: isGlobal.js
//// var y = 10;
// @Filename: consumer.js
//// var x = require('myMod');
//// /**/;
verify.completions({
marker: "",
includes: { name: "y", sortText: completion.SortText.GlobalsOrKeywords },
excludes: "invisible"
});
| {
"end_byte": 597,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/javaScriptModules14.ts"
} |
TypeScript/tests/cases/fourslash/importNameCodeFixNewImportFromAtTypes.ts_0_234 | /// <reference path="fourslash.ts" />
//// [|f1/*0*/();|]
// @Filename: node_modules/@types/myLib/index.d.ts
//// export function f1() {}
//// export var v1 = 5;
verify.importFixAtPosition([
`import { f1 } from "myLib";
f1();`
]); | {
"end_byte": 234,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/importNameCodeFixNewImportFromAtTypes.ts"
} |
TypeScript/tests/cases/fourslash/goToDefinitionOverriddenMember7.ts_0_162 | /// <reference path="./fourslash.ts"/>
// @noImplicitOverride: true
////class Foo {
//// [|/*1*/override|] m() {}
////}
verify.baselineGoToDefinition("1");
| {
"end_byte": 162,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/goToDefinitionOverriddenMember7.ts"
} |
TypeScript/tests/cases/fourslash/formatLiteralTypeInUnionOrIntersectionType.ts_0_514 | /// <reference path='fourslash.ts' />
//// type NumberAndString = {
//// a: number
//// } & {
//// b: string
//// };
////
//// type NumberOrString = {
//// a: number
//// } | {
//// b: string
//// };
////
//// type Complexed =
//// Foo &
//// Bar |
//// Baz;
format.document();
verify.currentFileContentIs(`type NumberAndString = {
a: number
} & {
b: string
};
type NumberOrString = {
a: number
} | {
b: string
};
type Complexed =
Foo &
Bar |
Baz;`);
| {
"end_byte": 514,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatLiteralTypeInUnionOrIntersectionType.ts"
} |
TypeScript/tests/cases/fourslash/deleteReopenedModule.ts_0_284 | /// <reference path="fourslash.ts" />
/////*start*/module M {
//// export class C { }
//// }/*end*/
////
////module M { }
////
////var c = new M.C();
goTo.marker('start');
var codeLength = test.markers()[1].position - test.markers()[0].position;
edit.deleteAtCaret(codeLength);
| {
"end_byte": 284,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/deleteReopenedModule.ts"
} |
TypeScript/tests/cases/fourslash/moduleNodeNextImportFix.ts_0_663 | /// <reference path="fourslash.ts" />
// @Filename: package.json
////{
//// "type": "module"
////}
// @Filename: tsconfig.json
////{
//// "compilerOptions": {
//// "outDir": "./dist",
//// "module": "node16",
//// "target": "esnext"
//// },
//// "include": ["./src"]
////}
// @Filename: src/index.mts
////import { util } from /*import*/'./deps.mts'
////export function main() {
//// util()
////}
// @Filename: src/deps.mts
////export function util() {}
verify.baselineSyntacticAndSemanticDiagnostics();
goTo.marker("import");
edit.replace(test.markers()[0].position, "'./deps.mts'".length, "'./deps.mjs'");
verify.noErrors(); | {
"end_byte": 663,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moduleNodeNextImportFix.ts"
} |
TypeScript/tests/cases/fourslash/codeFixAddMissingConstToArrayDestructuring4.ts_0_302 | /// <reference path='fourslash.ts' />
////[x, y()] = [0, () => 1];
verify.codeFix({
index: 0,
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "y"],
newFileContent:
`[x, y()] = [0, () => 1];
function y() {
throw new Error("Function not implemented.");
}
`
}); | {
"end_byte": 302,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixAddMissingConstToArrayDestructuring4.ts"
} |
TypeScript/tests/cases/fourslash/duplicateTypeParameters.ts_0_110 | /// <reference path="fourslash.ts" />
//// class A<B, /**/B> { }
goTo.marker();
verify.quickInfoExists();
| {
"end_byte": 110,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/duplicateTypeParameters.ts"
} |
TypeScript/tests/cases/fourslash/completionsThisPropertiesInPropertyDeclaration1.ts_0_643 | /// <reference path="fourslash.ts" />
////class Foo {
//// private _prop = 1;
//// public a = [|_/*1*/|]
////
//// foo() {
//// [|_/*2*/|]
//// }
////}
verify.completions({
marker: ["1", "2"],
includes: [
{
name: "_prop",
insertText: "this._prop",
kind: "property",
sortText: completion.SortText.SuggestedClassMembers,
source: completion.CompletionSource.ThisProperty,
text: "(property) Foo._prop: number",
kindModifiers: "private"
},
],
preferences: {
includeInsertTextCompletions: true
}
});
| {
"end_byte": 643,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsThisPropertiesInPropertyDeclaration1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile10.ts_0_497 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @checkJs: true
// @noEmit: true
// @filename: a.js
////let x = "";
////[|x|] = 1;
// verify.codeFixAvailable([
// { description: ts.Diagnostics.Ignore_this_error_message.message },
// { description: ts.Diagnostics.Disable_checking_for_this_file.message }
// ]);
verify.codeFix({
description: ts.Diagnostics.Disable_checking_for_this_file.message,
index: 1,
newFileContent:
`// @ts-nocheck
let x = "";
x = 1;`,
});
| {
"end_byte": 497,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile10.ts"
} |
TypeScript/tests/cases/fourslash/fixExactOptionalUnassignableProperties5.ts_0_664 | /// <reference path='fourslash.ts'/>
// @strictNullChecks: true
// @exactOptionalPropertyTypes: true
// @Filename: fixExactOptionalUnassignableProperties5.ts
//// interface User {
//// name: string
//// email?: string
//// }
//// declare const user: User
//// user.email = undefined;
verify.codeFixAvailable([
{ description: ts.Diagnostics.Add_undefined_to_optional_property_type.message }
]);
verify.codeFix({
description: ts.Diagnostics.Add_undefined_to_optional_property_type.message,
index: 0,
newFileContent:
`interface User {
name: string
email?: string | undefined
}
declare const user: User
user.email = undefined;`,
});
| {
"end_byte": 664,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/fixExactOptionalUnassignableProperties5.ts"
} |
TypeScript/tests/cases/fourslash/renameJsPropertyAssignment.ts_0_236 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: a.js
////function bar() {
////}
////[|bar.[|{| "contextRangeIndex": 0 |}foo|] = "foo";|]
////console.log(bar.[|foo|]);
verify.baselineRenameAtRangesWithText("foo");
| {
"end_byte": 236,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsPropertyAssignment.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageOptionalParamJS.ts_0_363 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: important.js
////function f([|a|]){
//// a;
////}
////f();
////f(1);
verify.codeFix({
description: "Infer parameter types from usage",
index: 0,
newFileContent:
`/**
* @param {number} [a]
*/
function f(a){
a;
}
f();
f(1);`,
});
| {
"end_byte": 363,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageOptionalParamJS.ts"
} |
TypeScript/tests/cases/fourslash/unusedMethodInClass3.ts_0_268 | /// <reference path='fourslash.ts' />
// @noUnusedLocals: true
////class greeter {
//// private function1 = function() {
//// }
////}
verify.codeFix({
description: `Remove unused declaration for: 'function1'`,
newFileContent: "class greeter {\n}",
});
| {
"end_byte": 268,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/unusedMethodInClass3.ts"
} |
TypeScript/tests/cases/fourslash/genericTypeParamUnrelatedToArguments1.ts_0_518 | /// <reference path='fourslash.ts'/>
////interface Foo<T> {
//// new (x: number): Foo<T>;
////}
////declare var f/*1*/1: Foo<number>;
////var f/*2*/2: Foo<number>;
////var f/*3*/3 = new Foo(3);
////var f/*4*/4: Foo<number> = new Foo(3);
////var f/*5*/5 = new Foo<number>(3);
////var f/*6*/6: Foo<number> = new Foo<number>(3);
verify.quickInfos({
1: "var f1: Foo<number>",
2: "var f2: Foo<number>",
3: "var f3: any",
4: "var f4: Foo<number>",
5: "var f5: any",
6: "var f6: Foo<number>"
});
| {
"end_byte": 518,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/genericTypeParamUnrelatedToArguments1.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoBindingPatternInJsdocNoCrash1.ts_0_230 | /// <reference path='fourslash.ts' />
/////** @type {({ /*1*/data: any }?) => { data: string[] }} */
////function useQuery({ data }): { data: string[] } {
//// return {
//// data,
//// };
////}
verify.quickInfoAt("1", "");
| {
"end_byte": 230,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoBindingPatternInJsdocNoCrash1.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports6.ts_0_365 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
////function foo(): number[] { return [42]; }
////export const c = [...foo()];
verify.codeFix({
description: "Add annotation of type 'number[]'",
index: 0,
newFileContent:
`function foo(): number[] { return [42]; }
export const c: number[] = [...foo()];`,
});
| {
"end_byte": 365,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports6.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_require_addNew.ts_0_634 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: /a.js
////const x = 0;
////module.exports = { x };
// @Filename: /b.js
////x/**/
verify.completions({
marker: "",
includes: {
name: "x",
source: "/a",
sourceDisplay: "./a",
text: "(alias) const x: 0\nimport x",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
preferences: { includeCompletionsForModuleExports: true },
});
verify.applyCodeActionFromCompletion("", {
name: "x",
source: "/a",
description: `Add import from "./a"`,
newFileContent: `const { x } = require("./a");
x`,
});
| {
"end_byte": 634,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_require_addNew.ts"
} |
TypeScript/tests/cases/fourslash/renameAlias3.ts_0_239 | /// <reference path='fourslash.ts'/>
////module SomeModule { [|export class [|{| "contextRangeIndex": 0 |}SomeClass|] { }|] }
////import M = SomeModule;
////import C = M.[|SomeClass|];
verify.baselineRenameAtRangesWithText("SomeClass");
| {
"end_byte": 239,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameAlias3.ts"
} |
TypeScript/tests/cases/fourslash/tsxCompletion13.ts_0_2004 | /// <reference path='fourslash.ts' />
//@Filename: file.tsx
// @jsx: preserve
// @skipLibCheck: true
//// declare module JSX {
//// interface Element { }
//// interface IntrinsicElements {
//// }
//// interface ElementAttributesProperty { props; }
//// }
//// interface ClickableProps {
//// children?: string;
//// className?: string;
//// }
//// interface ButtonProps extends ClickableProps {
//// onClick(event?: React.MouseEvent<HTMLButtonElement>): void;
//// }
//// interface LinkProps extends ClickableProps {
//// goTo: string;
//// }
//// declare function MainButton(buttonProps: ButtonProps): JSX.Element;
//// declare function MainButton(linkProps: LinkProps): JSX.Element;
//// declare function MainButton(props: ButtonProps | LinkProps): JSX.Element;
//// let opt = <MainButton /*1*/ />;
//// let opt = <MainButton children="chidlren" /*2*/ />;
//// let opt = <MainButton onClick={()=>{}} /*3*/ />;
//// let opt = <MainButton onClick={()=>{}} ignore-prop /*4*/ />;
//// let opt = <MainButton goTo="goTo" /*5*/ />;
//// let opt = <MainButton wrong /*6*/ />;
verify.completions(
{
marker: ["1", "6"],
exact: [
"goTo",
"onClick",
{ name: "children", kind: "property", kindModifiers: "optional", sortText: completion.SortText.OptionalMember },
{ name: "className", kind: "property", kindModifiers: "optional", sortText: completion.SortText.OptionalMember },
]
},
{
marker: "2",
exact: [
"goTo",
"onClick",
{ name: "className", kind: "property", kindModifiers: "optional", sortText: completion.SortText.OptionalMember },
]
},
{
marker: ["3", "4", "5"],
exact: [
{ name: "children", kind: "property", kindModifiers: "optional", sortText: completion.SortText.OptionalMember },
{ name: "className", kind: "property", kindModifiers: "optional", sortText: completion.SortText.OptionalMember },
]
},
);
| {
"end_byte": 2004,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/tsxCompletion13.ts"
} |
TypeScript/tests/cases/fourslash/completionEntryForArgumentConstrainedToString.ts_0_226 | /// <reference path="fourslash.ts" />
//// declare function test<P extends "a" | "b">(p: P): void;
////
//// test(/*ts*/)
////
verify.completions({ marker: ["ts"], includes: ['"a"', '"b"'], isNewIdentifierLocation: true });
| {
"end_byte": 226,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionEntryForArgumentConstrainedToString.ts"
} |
TypeScript/tests/cases/fourslash/completionListInTypeLiteralInTypeParameter3.ts_0_296 | /// <reference path="fourslash.ts" />
////interface Foo {
//// one: string;
//// two: number;
////}
////
////interface Bar<T extends Foo> {
//// foo: T;
////}
////
////var foobar: Bar<{ one: string, /**/
verify.completions({ marker: "", exact: "two", isNewIdentifierLocation: true });
| {
"end_byte": 296,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInTypeLiteralInTypeParameter3.ts"
} |
TypeScript/tests/cases/fourslash/getOccurrencesYield.ts_0_310 | /// <reference path='fourslash.ts' />
////function* f() {
//// [|yield|] 100;
//// [|y/**/ield|] [|yield|] 200;
//// class Foo {
//// *memberFunction() {
//// return yield 1;
//// }
//// }
//// return function* g() {
//// yield 1;
//// }
////}
verify.baselineDocumentHighlights();
| {
"end_byte": 310,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getOccurrencesYield.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.