_id stringlengths 21 254 | text stringlengths 1 93.7k | metadata dict |
|---|---|---|
TypeScript/tests/cases/projects/jsFileCompilation/DifferentNamesSpecifiedWithAllowJs/b.js_0_38 | var test2 = 10; // Should get compiled | {
"end_byte": 38,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/DifferentNamesSpecifiedWithAllowJs/b.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecifiedWithAllowJs/a.d.ts_0_22 | declare var a: number; | {
"end_byte": 22,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecifiedWithAllowJs/a.d.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecifiedWithAllowJs/a.js_0_40 | var test1 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecifiedWithAllowJs/a.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsSpecified/a.d.ts_0_25 | declare var test: number; | {
"end_byte": 25,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsSpecified/a.d.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsSpecified/a.js_0_40 | var test1 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsSpecified/a.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsSpecifiedWithAllowJs/a.d.ts_0_25 | declare var test: number; | {
"end_byte": 25,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsSpecifiedWithAllowJs/a.d.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsSpecifiedWithAllowJs/a.js_0_40 | var test1 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsSpecifiedWithAllowJs/a.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecified/a.d.ts_0_22 | declare var a: number; | {
"end_byte": 22,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecified/a.d.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecified/a.js_0_40 | var test1 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameDTsNotSpecified/a.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecified/a.ts_0_14 | var test = 10; | {
"end_byte": 14,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecified/a.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecified/b.js_0_40 | var test2 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecified/b.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameFilesNotSpecified/a.js_0_40 | var test1 = 10; // Shouldnt get compiled | {
"end_byte": 40,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameFilesNotSpecified/a.js"
} |
TypeScript/tests/cases/projects/jsFileCompilation/SameNameFilesNotSpecified/a.ts_0_14 | var test = 10; | {
"end_byte": 14,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/SameNameFilesNotSpecified/a.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecifiedWithAllowJs/a.ts_0_14 | var test = 10; | {
"end_byte": 14,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecifiedWithAllowJs/a.ts"
} |
TypeScript/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecifiedWithAllowJs/b.js_0_38 | var test2 = 10; // Should get compiled | {
"end_byte": 38,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/jsFileCompilation/DifferentNamesNotSpecifiedWithAllowJs/b.js"
} |
TypeScript/tests/cases/projects/outputdir_module_multifolder/test.ts_0_290 | import m1 = require("ref/m1");
import m2 = require("../outputdir_module_multifolder_ref/m2");
export var a1 = 10;
export class c1 {
public p1: number;
}
export var instance1 = new c1();
export function f1() {
return instance1;
}
export var a2 = m1.m1_c1;
export var a3 = m2.m2_c1; | {
"end_byte": 290,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/outputdir_module_multifolder/test.ts"
} |
TypeScript/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts_0_167 | export var m1_a1 = 10;
export class m1_c1 {
public m1_c1_p1: number;
}
export var m1_instance1 = new m1_c1();
export function m1_f1() {
return m1_instance1;
} | {
"end_byte": 167,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/outputdir_module_multifolder/ref/m1.ts"
} |
TypeScript/tests/cases/projects/DeclareExportAdded/consumer.ts_0_102 | ///<reference path="ref.d.ts" />
// in the generated code a 'this' is added before this call
M1.f1(); | {
"end_byte": 102,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/DeclareExportAdded/consumer.ts"
} |
TypeScript/tests/cases/projects/DeclareExportAdded/ref.d.ts_0_53 | declare module M1
{
export function f1(): void;
} | {
"end_byte": 53,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/DeclareExportAdded/ref.d.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-IndirectReference/indirectExternalModule.ts_0_30 | export class indirectClass {
} | {
"end_byte": 30,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-IndirectReference/indirectExternalModule.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-IndirectReference/externalModule.ts_0_88 | import im0 = require("indirectExternalModule");
export var x = new im0.indirectClass();
| {
"end_byte": 88,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-IndirectReference/externalModule.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-IndirectReference/test.ts_0_61 | import im1 = require("externalModule");
export var x = im1.x; | {
"end_byte": 61,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-IndirectReference/test.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-InsideModule/mExported.ts_0_169 | export module me {
export class class1 {
public prop1 = 0;
}
export var x = class1;
export function foo() {
return new class1();
}
} | {
"end_byte": 169,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-InsideModule/mExported.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-InsideModule/testGlo.ts_0_963 | module m2 {
export import mExported = require("mExported");
export var c1 = new mExported.me.class1;
export function f1() {
return new mExported.me.class1();
}
export var x1 = mExported.me.x;
export class class1 extends mExported.me.class1 {
}
var c2 = new mExported.me.class1;
function f2() {
return new mExported.me.class1();
}
var x2 = mExported.me.x;
class class2 extends mExported.me.class1 {
}
import mNonExported = require("mNonExported");
export var c3 = new mNonExported.mne.class1;
export function f3() {
return new mNonExported.mne.class1();
}
export var x3 = mNonExported.mne.x;
export class class3 extends mNonExported.mne.class1 {
}
var c4 = new mNonExported.mne.class1;
function f4() {
return new mNonExported.mne.class1();
}
var x4 = mNonExported.mne.x;
class class4 extends mNonExported.mne.class1 {
}
} | {
"end_byte": 963,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-InsideModule/testGlo.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-InsideModule/test.ts_0_985 | export module m1 {
}
module m2 {
export import mExported = require("mExported");
export var c1 = new mExported.me.class1;
export function f1() {
return new mExported.me.class1();
}
export var x1 = mExported.me.x;
export class class1 extends mExported.me.class1 {
}
var c2 = new mExported.me.class1;
function f2() {
return new mExported.me.class1();
}
var x2 = mExported.me.x;
class class2 extends mExported.me.class1 {
}
import mNonExported = require("mNonExported");
export var c3 = new mNonExported.mne.class1;
export function f3() {
return new mNonExported.mne.class1();
}
export var x3 = mNonExported.mne.x;
export class class3 extends mNonExported.mne.class1 {
}
var c4 = new mNonExported.mne.class1;
function f4() {
return new mNonExported.mne.class1();
}
var x4 = mNonExported.mne.x;
class class4 extends mNonExported.mne.class1 {
}
} | {
"end_byte": 985,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-InsideModule/test.ts"
} |
TypeScript/tests/cases/projects/privacyCheck-InsideModule/mNonExported.ts_0_170 | export module mne {
export class class1 {
public prop1 = 0;
}
export var x = class1;
export function foo() {
return new class1();
}
} | {
"end_byte": 170,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/projects/privacyCheck-InsideModule/mNonExported.ts"
} |
TypeScript/tests/cases/unittests/matchFiles.ts_0_3907 | /// <reference path="..\..\..\src\harness\external\mocha.d.ts" />
/// <reference path="..\..\..\src\harness\harness.ts" />
/// <reference path="..\..\..\src\harness\virtualFileSystem.ts" />
namespace ts {
const caseInsensitiveBasePath = "c:/dev/";
const caseInsensitiveHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
"c:/dev/a.ts",
"c:/dev/a.d.ts",
"c:/dev/a.js",
"c:/dev/b.ts",
"c:/dev/b.js",
"c:/dev/c.d.ts",
"c:/dev/z/a.ts",
"c:/dev/z/abz.ts",
"c:/dev/z/aba.ts",
"c:/dev/z/b.ts",
"c:/dev/z/bbz.ts",
"c:/dev/z/bba.ts",
"c:/dev/x/a.ts",
"c:/dev/x/aa.ts",
"c:/dev/x/b.ts",
"c:/dev/x/y/a.ts",
"c:/dev/x/y/b.ts",
"c:/dev/js/a.js",
"c:/dev/js/b.js",
"c:/ext/ext.ts",
"c:/ext/b/a..b.ts"
]);
const caseSensitiveBasePath = "/dev/";
const caseSensitiveHost = new Utils.MockParseConfigHost(caseSensitiveBasePath, /*useCaseSensitiveFileNames*/ true, [
"/dev/a.ts",
"/dev/a.d.ts",
"/dev/a.js",
"/dev/b.ts",
"/dev/b.js",
"/dev/A.ts",
"/dev/B.ts",
"/dev/c.d.ts",
"/dev/z/a.ts",
"/dev/z/abz.ts",
"/dev/z/aba.ts",
"/dev/z/b.ts",
"/dev/z/bbz.ts",
"/dev/z/bba.ts",
"/dev/x/a.ts",
"/dev/x/b.ts",
"/dev/x/y/a.ts",
"/dev/x/y/b.ts",
"/dev/js/a.js",
"/dev/js/b.js",
]);
const caseInsensitiveMixedExtensionHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
"c:/dev/a.ts",
"c:/dev/a.d.ts",
"c:/dev/a.js",
"c:/dev/b.tsx",
"c:/dev/b.d.ts",
"c:/dev/b.jsx",
"c:/dev/c.tsx",
"c:/dev/c.js",
"c:/dev/d.js",
"c:/dev/e.jsx",
"c:/dev/f.other"
]);
const caseInsensitiveCommonFoldersHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
"c:/dev/a.ts",
"c:/dev/a.d.ts",
"c:/dev/a.js",
"c:/dev/b.ts",
"c:/dev/node_modules/a.ts",
"c:/dev/bower_components/a.ts",
"c:/dev/jspm_packages/a.ts"
]);
function assertParsed(actual: ts.ParsedCommandLine, expected: ts.ParsedCommandLine): void {
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
}
function validateMatches(expected: ts.ParsedCommandLine, json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]) {
{
const jsonText = JSON.stringify(json);
const result = parseJsonText("c:/dev/tsconfig.json", jsonText);
const actual = ts.parseJsonSourceFileConfigFileContent(result, host, basePath, existingOptions, configFileName, resolutionStack);
for (const error of expected.errors) {
if (error.file) {
error.file = result;
}
}
assertParsed(actual, expected);
}
{
const actual = ts.parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack);
expected.errors = map(expected.errors, error => {
return <Diagnostic>{
category: error.category,
code: error.code,
file: undefined,
length: undefined,
messageText: error.messageText,
start: undefined,
};
});
assertParsed(actual, expected);
}
} | {
"end_byte": 3907,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/unittests/matchFiles.ts"
} |
TypeScript/tests/cases/unittests/matchFiles.ts_3913_13944 | describe("matchFiles", () => {
describe("with literal file list", () => {
it("without exclusions", () => {
const json = {
files: [
"a.ts",
"b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("missing files are still present", () => {
const json = {
files: [
"z.ts",
"x.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/z.ts",
"c:/dev/x.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("are not removed due to excludes", () => {
const json = {
files: [
"a.ts",
"b.ts"
],
exclude: [
"b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
});
describe("with literal include list", () => {
it("without exclusions", () => {
const json = {
include: [
"a.ts",
"b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with non .ts file extensions are excluded", () => {
const json = {
include: [
"a.js",
"b.js"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with missing files are excluded", () => {
const json = {
include: [
"z.ts",
"x.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with literal excludes", () => {
const json = {
include: [
"a.ts",
"b.ts"
],
exclude: [
"b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with wildcard excludes", () => {
const json = {
include: [
"a.ts",
"b.ts",
"z/a.ts",
"z/abz.ts",
"z/aba.ts",
"x/b.ts"
],
exclude: [
"*.ts",
"z/??z.ts",
"*/b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/z/a.ts",
"c:/dev/z/aba.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with recursive excludes", () => {
const json = {
include: [
"a.ts",
"b.ts",
"x/a.ts",
"x/b.ts",
"x/y/a.ts",
"x/y/b.ts"
],
exclude: [
"**/b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with case sensitive exclude", () => {
const json = {
include: [
"B.ts"
],
exclude: [
"**/b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"/dev/B.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseSensitiveHost, caseSensitiveBasePath);
});
it("with common package folders and no exclusions", () => {
const json = {
include: [
"a.ts",
"b.ts",
"node_modules/a.ts",
"bower_components/a.ts",
"jspm_packages/a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
it("with common package folders and exclusions", () => {
const json = {
include: [
"a.ts",
"b.ts",
"node_modules/a.ts",
"bower_components/a.ts",
"jspm_packages/a.ts"
],
exclude: [
"a.ts",
"b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/bower_components/a.ts",
"c:/dev/jspm_packages/a.ts",
"c:/dev/node_modules/a.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
it("with common package folders and empty exclude", () => {
const json = {
include: [
"a.ts",
"b.ts",
"node_modules/a.ts",
"bower_components/a.ts",
"jspm_packages/a.ts"
],
exclude: <string[]>[]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts",
"c:/dev/bower_components/a.ts",
"c:/dev/jspm_packages/a.ts",
"c:/dev/node_modules/a.ts"
],
wildcardDirectories: {},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
}); | {
"end_byte": 13944,
"start_byte": 3913,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/unittests/matchFiles.ts"
} |
TypeScript/tests/cases/unittests/matchFiles.ts_13954_25908 | describe("with wildcard include list", () => {
it("same named declarations are excluded", () => {
const json = {
include: [
"*.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts",
"c:/dev/c.d.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.None
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("`*` matches only ts files", () => {
const json = {
include: [
"*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts",
"c:/dev/c.d.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.None
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("`?` matches only a single character", () => {
const json = {
include: [
"x/?.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/x/a.ts",
"c:/dev/x/b.ts"
],
wildcardDirectories: {
"c:/dev/x": ts.WatchDirectoryFlags.None
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with recursive directory", () => {
const json = {
include: [
"**/a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts",
"c:/dev/z/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with multiple recursive directories", () => {
const json = {
include: [
"x/y/**/a.ts",
"x/**/a.ts",
"z/**/a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts",
"c:/dev/z/a.ts"
],
wildcardDirectories: {
"c:/dev/x": ts.WatchDirectoryFlags.Recursive,
"c:/dev/z": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("case sensitive", () => {
const json = {
include: [
"**/A.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"/dev/A.ts"
],
wildcardDirectories: {
"/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseSensitiveHost, caseSensitiveBasePath);
});
it("with missing files are excluded", () => {
const json = {
include: [
"*/z.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("always include literal files", () => {
const json = {
files: [
"a.ts"
],
include: [
"*/z.ts"
],
exclude: [
"**/a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("exclude folders", () => {
const json = {
include: [
"**/*"
],
exclude: [
"z",
"x"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts",
"c:/dev/c.d.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with common package folders and no exclusions", () => {
const json = {
include: [
"**/a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
it("with common package folders and exclusions", () => {
const json = {
include: [
"**/a.ts"
],
exclude: [
"a.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/bower_components/a.ts",
"c:/dev/jspm_packages/a.ts",
"c:/dev/node_modules/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
it("with common package folders and empty exclude", () => {
const json = {
include: [
"**/a.ts"
],
exclude: <string[]>[]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/bower_components/a.ts",
"c:/dev/jspm_packages/a.ts",
"c:/dev/node_modules/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
},
};
validateMatches(expected, json, caseInsensitiveCommonFoldersHost, caseInsensitiveBasePath);
});
it("exclude .js files when allowJs=false", () => {
const json = {
compilerOptions: {
allowJs: false
},
include: [
"js/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: false
},
errors: [],
fileNames: [],
wildcardDirectories: {
"c:/dev/js": ts.WatchDirectoryFlags.None
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("include .js files when allowJs=true", () => {
const json = {
compilerOptions: {
allowJs: true
},
include: [
"js/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/js/a.js",
"c:/dev/js/b.js"
],
wildcardDirectories: {
"c:/dev/js": ts.WatchDirectoryFlags.None
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("include paths outside of the project", () => {
const json = {
include: [
"*",
"c:/ext/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.ts",
"c:/dev/c.d.ts",
"c:/ext/ext.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.None,
"c:/ext": ts.WatchDirectoryFlags.None
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
}); | {
"end_byte": 25908,
"start_byte": 13954,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/unittests/matchFiles.ts"
} |
TypeScript/tests/cases/unittests/matchFiles.ts_25922_36466 | it("include paths outside of the project using relative paths", () => {
const json = {
include: [
"*",
"../ext/*"
],
exclude: [
"**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/ext/ext.ts"
],
wildcardDirectories: {
"c:/ext": ts.WatchDirectoryFlags.None
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("exclude paths outside of the project using relative paths", () => {
const json = {
include: [
"c:/**/*"
],
exclude: [
"../**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("include files with .. in their name", () => {
const json = {
include: [
"c:/ext/b/a..b.ts"
],
exclude: [
"**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/ext/b/a..b.ts"
],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("exclude files with .. in their name", () => {
const json = {
include: [
"c:/ext/**/*"
],
exclude: [
"c:/ext/b/a..b.ts"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [
"c:/ext/ext.ts",
],
wildcardDirectories: {
"c:/ext": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("with jsx=none, allowJs=false", () => {
const json = {
compilerOptions: {
allowJs: false
}
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: false
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
});
it("with jsx=preserve, allowJs=false", () => {
const json = {
compilerOptions: {
jsx: "preserve",
allowJs: false
}
};
const expected: ts.ParsedCommandLine = {
options: {
jsx: ts.JsxEmit.Preserve,
allowJs: false
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
});
it("with jsx=react-native, allowJs=false", () => {
const json = {
compilerOptions: {
jsx: "react-native",
allowJs: false
}
};
const expected: ts.ParsedCommandLine = {
options: {
jsx: ts.JsxEmit.ReactNative,
allowJs: false
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
it("with jsx=none, allowJs=true", () => {
const json = {
compilerOptions: {
allowJs: true
}
};
const expected: ts.ParsedCommandLine = {
options: {
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
"c:/dev/d.js",
"c:/dev/e.jsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
});
it("with jsx=preserve, allowJs=true", () => {
const json = {
compilerOptions: {
jsx: "preserve",
allowJs: true
}
};
const expected: ts.ParsedCommandLine = {
options: {
jsx: ts.JsxEmit.Preserve,
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
"c:/dev/d.js",
"c:/dev/e.jsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
});
it("with jsx=react-native, allowJs=true", () => {
const json = {
compilerOptions: {
jsx: "react-native",
allowJs: true
}
};
const expected: ts.ParsedCommandLine = {
options: {
jsx: ts.JsxEmit.ReactNative,
allowJs: true
},
errors: [],
fileNames: [
"c:/dev/a.ts",
"c:/dev/b.tsx",
"c:/dev/c.tsx",
"c:/dev/d.js",
"c:/dev/e.jsx",
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
const actual = ts.parseJsonConfigFileContent(json, caseInsensitiveMixedExtensionHost, caseInsensitiveBasePath);
assert.deepEqual(actual.fileNames, expected.fileNames);
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
assert.deepEqual(actual.errors, expected.errors);
});
describe("with trailing recursive directory", () => {
it("in includes", () => {
const json = {
include: [
"**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**")
],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("in excludes", () => {
const json = {
include: [
"**/*"
],
exclude: [
"**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
}); | {
"end_byte": 36466,
"start_byte": 25922,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/unittests/matchFiles.ts"
} |
TypeScript/tests/cases/unittests/matchFiles.ts_36479_42714 | describe("with multiple recursive directory patterns", () => {
it("in includes", () => {
const json = {
include: [
"**/x/**/*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, "**/x/**/*")
],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("in excludes", () => {
const json = {
include: [
"**/a.ts"
],
exclude: [
"**/x/**"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, "**/x/**")
],
fileNames: [
"c:/dev/a.ts",
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts",
"c:/dev/z/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
});
describe("with parent directory symbols after a recursive directory pattern", () => {
it("in includes immediately after", () => {
const json = {
include: [
"**/../*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/../*")
],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("in includes after a subdirectory", () => {
const json = {
include: [
"**/y/../*"
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/y/../*")
],
fileNames: [],
wildcardDirectories: {}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("in excludes immediately after", () => {
const json = {
include: [
"**/a.ts"
],
exclude: [
"**/.."
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/..")
],
fileNames: [
"c:/dev/a.ts",
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts",
"c:/dev/z/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
it("in excludes after a subdirectory", () => {
const json = {
include: [
"**/a.ts"
],
exclude: [
"**/y/.."
]
};
const expected: ts.ParsedCommandLine = {
options: {},
errors: [
ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, "**/y/..")
],
fileNames: [
"c:/dev/a.ts",
"c:/dev/x/a.ts",
"c:/dev/x/y/a.ts",
"c:/dev/z/a.ts"
],
wildcardDirectories: {
"c:/dev": ts.WatchDirectoryFlags.Recursive
}
};
validateMatches(expected, json, caseInsensitiveHost, caseInsensitiveBasePath);
});
});
});
});
} | {
"end_byte": 42714,
"start_byte": 36479,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/unittests/matchFiles.ts"
} |
TypeScript/tests/cases/transpile/declarationBasicSyntax.ts_0_896 | // @declaration: true
// @declarationMap: true,false
// @target: es6
// @filename: variables.ts
export const a = 1;
export let b = 2;
export var c = 3;
using d = undefined;
export { d };
await using e = undefined;
export { e };
// @filename: interface.ts
export interface Foo {
a: string;
readonly b: string;
c?: string;
}
// @filename: class.ts
const i = Symbol();
export class Bar {
a: string;
b?: string;
declare c: string;
#d: string;
public e: string;
protected f: string;
private g: string;
["h"]: string;
[i]: string;
}
export abstract class Baz {
abstract a: string;
abstract method(): void;
}
// @filename: namespace.ts
export namespace ns {
namespace internal {
export class Foo {}
}
export namespace nested {
export import inner = internal;
}
}
// @filename: alias.ts
export type A<T> = { x: T }; | {
"end_byte": 896,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationBasicSyntax.ts"
} |
TypeScript/tests/cases/transpile/declarationEmitPartialNodeReuse.ts_0_558 | // @strict: true
// @declaration: true
// @emitDeclarationOnly: true
// @target: es2020
// @filename: a.ts
export type SpecialString = string;
type PrivateSpecialString = string;
export namespace N {
export type SpecialString = string;
}
export const o = (p1: SpecialString, p2: PrivateSpecialString, p3: N.SpecialString) => null! as { foo: SpecialString, bar: PrivateSpecialString, baz: N.SpecialString };
// @filename: b.ts
import * as a from "./a";
export const g = a.o
// @filename: c.ts
import { o, SpecialString } from "./a";
export const g = o | {
"end_byte": 558,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationEmitPartialNodeReuse.ts"
} |
TypeScript/tests/cases/transpile/declarationsSimple.ts_0_160 | // @declaration: true
export const c: number = 1;
export interface A {
x: number;
}
let expr: { x: number; };
expr = {
x: 12,
}
export default expr; | {
"end_byte": 160,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationsSimple.ts"
} |
TypeScript/tests/cases/transpile/declarationLinkedAliases.ts_0_76 | // @declaration: true
import { A } from "mod";
import B = A.C;
export { B }; | {
"end_byte": 76,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationLinkedAliases.ts"
} |
TypeScript/tests/cases/transpile/declarationAsyncAndGeneratorFunctions.ts_0_374 | // @declaration: true
// @target: esnext
export async function asyncFn() {
return {} as Promise<void>
}
export async function asyncFn2() {
return {} as number
}
export async function asyncFn3() {
return (await 42) as number;
}
export function* generatorFn() {
return {} as number
}
export async function* asyncGeneratorFn() {
return {} as number
} | {
"end_byte": 374,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationAsyncAndGeneratorFunctions.ts"
} |
TypeScript/tests/cases/transpile/declarationTypeWithComputedName.ts_0_203 | // @declaration: true
// @emitDeclarationOnly: true
import {Foo} from './a';
export type Bar = {
[Foo.A]: 1;
[Foo.B]: 2;
}
export const valBar = null as any as {
[Foo.A]: 1;
[Foo.B]: 2;
};
| {
"end_byte": 203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationTypeWithComputedName.ts"
} |
TypeScript/tests/cases/transpile/declarationUnresolvedGlobalReferencesNoErrors.ts_0_532 | // @declaration: true
// @emitDeclarationOnly: true
export const x: MissingGlobalType = null!;
export const fn = (a: MissingGlobalType): MissingGlobalType => null!;
export const fn2 = (a: MissingGlobalType) => null! as MissingGlobalType;
export const x2: typeof missingGlobalValue = null!;
export const fn3 = (a: typeof missingGlobalValue): typeof missingGlobalValue => null!;
export const fn4 = (a: typeof missingGlobalValue) => null! as typeof missingGlobalValue;
export const o : {
[missingGlobalValue]: string
} = null!;
| {
"end_byte": 532,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationUnresolvedGlobalReferencesNoErrors.ts"
} |
TypeScript/tests/cases/transpile/jsWithInlineSourceMapBasic.ts_0_875 | // @inlineSourceMap: true,false
// @target: es6
// @filename: variables.ts
export const a = 1;
export let b = 2;
export var c = 3;
using d = undefined;
export { d };
await using e = undefined;
export { e };
// @filename: interface.ts
export interface Foo {
a: string;
readonly b: string;
c?: string;
}
// @filename: class.ts
const i = Symbol();
export class Bar {
a: string;
b?: string;
declare c: string;
#d: string;
public e: string;
protected f: string;
private g: string;
["h"]: string;
[i]: string;
}
export abstract class Baz {
abstract a: string;
abstract method(): void;
}
// @filename: namespace.ts
export namespace ns {
namespace internal {
export class Foo {}
}
export namespace nested {
export import inner = internal;
}
}
// @filename: alias.ts
export type A<T> = { x: T }; | {
"end_byte": 875,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/jsWithInlineSourceMapBasic.ts"
} |
TypeScript/tests/cases/transpile/jsWithSourceMapBasic.ts_0_869 | // @sourceMap: true,false
// @target: es6
// @filename: variables.ts
export const a = 1;
export let b = 2;
export var c = 3;
using d = undefined;
export { d };
await using e = undefined;
export { e };
// @filename: interface.ts
export interface Foo {
a: string;
readonly b: string;
c?: string;
}
// @filename: class.ts
const i = Symbol();
export class Bar {
a: string;
b?: string;
declare c: string;
#d: string;
public e: string;
protected f: string;
private g: string;
["h"]: string;
[i]: string;
}
export abstract class Baz {
abstract a: string;
abstract method(): void;
}
// @filename: namespace.ts
export namespace ns {
namespace internal {
export class Foo {}
}
export namespace nested {
export import inner = internal;
}
}
// @filename: alias.ts
export type A<T> = { x: T }; | {
"end_byte": 869,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/jsWithSourceMapBasic.ts"
} |
TypeScript/tests/cases/transpile/declarationUnresolvedTypeReference2.ts_0_641 | // @declaration:true
// @emitDeclarationOnly: true
// @fileName: globals.ts
type MissingGlobalType = "global";
declare const missingGlobalValue: "A";
// @fileName: index.ts
// this test assumes there is some global definitions for MissingGlobalType and missingGlobalValue that are not available to transpileDeclaration
export const fn = (a: MissingGlobalType): MissingGlobalType => null!;
export const fn2 = (a: MissingGlobalType) => null! as MissingGlobalType;
export const fn3 = (a: typeof missingGlobalValue): typeof missingGlobalValue => null!;
export const fn4 = (a: typeof missingGlobalValue) => null! as typeof missingGlobalValue;
| {
"end_byte": 641,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationUnresolvedTypeReference2.ts"
} |
TypeScript/tests/cases/transpile/declarationLocalAliasOfImportAlias.ts_0_203 | // @declaration: true
import { Record } from "./a";
export type Foo<K extends string> = Record<K, number>;
export const obj = {
doThing<K extends string>(_k: K): Foo<K> {
return {} as any;
},
}; | {
"end_byte": 203,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationLocalAliasOfImportAlias.ts"
} |
TypeScript/tests/cases/transpile/declarationPartialNodeReuseTypeOf.ts_0_553 | // @strict: true
// @declaration: true
// @emitDeclarationOnly: true
// @target: es2020
// @filename: a.ts
export const nImported = "nImported"
export const nNotImported = "nNotImported"
const nPrivate = "private"
export const o = (p1: typeof nImported, p2: typeof nNotImported, p3: typeof nPrivate) => null! as { foo: typeof nImported, bar: typeof nPrivate, baz: typeof nNotImported }
// @filename: b.ts
import { o, nImported } from "./a";
export const g = o
console.log(nImported);
// @filename: c.ts
import * as a from "./a";
export const g = a.o
| {
"end_byte": 553,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationPartialNodeReuseTypeOf.ts"
} |
TypeScript/tests/cases/transpile/declarationUnresolvedTypeReference.ts_0_182 | // @declaration:true
// @emitDeclarationOnly: true
import { type Type } from "./a";
export const foo = (_: Type): void => {};
export const bar = (_: import("./a").Type): void => {}; | {
"end_byte": 182,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationUnresolvedTypeReference.ts"
} |
TypeScript/tests/cases/transpile/declarationNotInScopeTypes.ts_0_273 | // @declaration: true
// @target: es6
// @filename: variables.ts
const x = "";
export function one() {
return {} as typeof x;
}
export function two() {
const y = "";
return {} as typeof y;
}
export function three() {
type Z = string;
return {} as Z;
} | {
"end_byte": 273,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationNotInScopeTypes.ts"
} |
TypeScript/tests/cases/transpile/declarationFunctionDeclarations.ts_0_3123 | // @declaration: true
// @target: esnext
// @strict: true
//@fileName: fnDecl.ts
type T = number[]
export function fnDeclBasic1(p: number[] | string[] | [T] = [], rParam: string): void { };
export function fnDeclBasic2(p: (n: T) => T = () => null!, rParam: string): void { };
export function fnDeclBasic3(p: new () => any = class {}, rParam: string): void { };
export function fnDeclBasic4(p: [T] = [[]], rParam: string): void { };
export function fnDeclBasic5(p: { a: T } = { a: [] }, rParam: string): void { };
export function fnDeclBasic6(p: `_${string}` = "_", rParam: string): void { };
export function fnDeclBasic7(p: { a?: string } & number[] = [], rParam: string): void { };
export function fnDeclBasic8(p: (number[] | string[]) | number = [], rParam: string): void { };
export function fnDeclHasUndefined(p: T | undefined = [], rParam: string): void { };
export function fnDeclBad(p: T = [], rParam: string): void { };
export const fnExprOk1 = function (array: number[] = [], rParam: string): void { };
export const fnExprOk2 = function (array: T | undefined = [], rParam: string): void { };
export const fnExprBad = function (array: T = [], rParam: string): void { };
export const arrowOk1 = (array: number[] = [], rParam: string): void => { };
export const arrowOk2 = (array: T | undefined = [], rParam: string): void => { };
export const arrowBad = (array: T = [], rParam: string): void => { };
export const inObjectLiteralFnExprOk1 = { o: function (array: number[] = [], rParam: string): void { } };
export const inObjectLiteralFnExprOk2 = { o: function (array: T | undefined = [], rParam: string): void { } };
export const inObjectLiteralFnExprBad = { o: function (array: T = [], rParam: string): void { } };
export const inObjectLiteralArrowOk1 = { o: (array: number[] = [], rParam: string): void => { } };
export const inObjectLiteralArrowOk2 = { o: (array: T | undefined = [], rParam: string): void => { } };
export const inObjectLiteralArrowBad = { o: (array: T = [], rParam: string): void => { } };
export const inObjectLiteralMethodOk1 = { o(array: number[] = [], rParam: string): void { } };
export const inObjectLiteralMethodOk2 = { o(array: T | undefined = [], rParam: string): void { } };
export const inObjectLiteralMethodBad = { o(array: T = [], rParam: string): void { } };
export class InClassFnExprOk1 { o = function (array: number[] = [], rParam: string): void { } };
export class InClassFnExprOk2 { o = function (array: T | undefined = [], rParam: string): void { } };
export class InClassFnExprBad { o = function (array: T = [], rParam: string): void { } };
export class InClassArrowOk1 { o = (array: number[] = [], rParam: string): void => { } };
export class InClassArrowOk2 { o = (array: T | undefined = [], rParam: string): void => { } };
export class InClassArrowBad { o = (array: T = [], rParam: string): void => { } };
export class InClassMethodOk1 { o(array: number[] = [], rParam: string): void { } };
export class InClassMethodOk2 { o(array: T | undefined = [], rParam: string): void { } };
export class InClassMethodBad { o(array: T = [], rParam: string): void { } };
| {
"end_byte": 3123,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationFunctionDeclarations.ts"
} |
TypeScript/tests/cases/transpile/declarationSingleFileHasErrors.ts_0_62 | // @declaration: true
export const a number = "missing colon"; | {
"end_byte": 62,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationSingleFileHasErrors.ts"
} |
TypeScript/tests/cases/transpile/declarationTypeParameterConstraint.ts_0_173 | // @declaration: true
import { type In, type Out, type Base } from "./a";
export const object = {
doThing<T extends Base>(_t: T, _in: In[T]): Out[T] {
return;
},
}; | {
"end_byte": 173,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationTypeParameterConstraint.ts"
} |
TypeScript/tests/cases/transpile/declarationComputedPropertyNames.ts_0_1647 | // @declaration: true
// @emitDeclarationOnly: true
// @target: es6
export namespace presentNs {
export const a = Symbol();
}
const aliasing = Symbol;
export type A = {
[missing]: number,
[ns.missing]: number,
[presentNs.a]: number,
[Symbol.iterator]: number,
[globalThis.Symbol.toStringTag]: number,
[(globalThis.Symbol).unscopables]: number,
[aliasing.isConcatSpreadable]: number,
[1]: number,
["2"]: number,
[(missing2)]: number,
[Math.random() > 0.5 ? "f1" : "f2"]: number,
};
export interface B {
[missing]: number,
[ns.missing]: number,
[presentNs.a]: number,
[Symbol.iterator]: number,
[globalThis.Symbol.toStringTag]: number,
[(globalThis.Symbol).unscopables]: number,
[aliasing.isConcatSpreadable]: number,
[1]: number,
["2"]: number,
[(missing2)]: number,
[Math.random() > 0.5 ? "f1" : "f2"]: number,
}
export class C {
[missing]: number = 1;
[ns.missing]: number = 1;
[presentNs.a]: number = 1;
[Symbol.iterator]: number = 1;
[globalThis.Symbol.toStringTag]: number = 1;
[(globalThis.Symbol).unscopables]: number = 1;
[aliasing.isConcatSpreadable]: number = 1;
[1]: number = 1;
["2"]: number = 1;
[(missing2)]: number = 1;
[Math.random() > 0.5 ? "f1" : "f2"]: number = 1;
}
export const D = {
[missing]: 1,
[ns.missing]: 1,
[presentNs.a]: 1,
[Symbol.iterator]: 1,
[globalThis.Symbol.toStringTag]: 1,
[(globalThis.Symbol).unscopables]: 1,
[aliasing.isConcatSpreadable]: 1,
[1]: 1,
["2"]: 1,
[(missing2)]: 1,
[Math.random() > 0.5 ? "f1" : "f2"]: 1,
};
| {
"end_byte": 1647,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationComputedPropertyNames.ts"
} |
TypeScript/tests/cases/transpile/declarationRestParameters.ts_0_397 | // @declaration: true
// @target: es2015
// @emitDeclarationOnly: true
// @fileName: v1.ts
export const v1 = (...a: [n: "n", a: "a"]): {
/** r rest param */
a: typeof a,
} => {
return null!
}
// @fileName: v2.ts
const n = Symbol();
export const v2 = (...a: [n: "n", a: "a"]): {
/** r rest param */
a: typeof a,
/** module var */
n: typeof n,
} => {
return null!
} | {
"end_byte": 397,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationRestParameters.ts"
} |
TypeScript/tests/cases/transpile/declarationSingleFileHasErrorsReported.ts_0_90 | // @declaration: true
// @reportDiagnostics: true
export const a string = "missing colon"; | {
"end_byte": 90,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationSingleFileHasErrorsReported.ts"
} |
TypeScript/tests/cases/transpile/declarationCrossFileInferences.ts_0_287 | // @declaration: true
// @filename: defines.ts
export class A {
field = { x: 1 }
}
// @filename: consumes.ts
import {A} from "./defines.js";
export function create() {
return new A();
}
// @filename: exposes.ts
import {create} from "./consumes.js";
export const value = create(); | {
"end_byte": 287,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationCrossFileInferences.ts"
} |
TypeScript/tests/cases/transpile/declarationSelfReferentialConstraint.ts_0_127 | // @declaration: true
// @emitDeclarationOnly: true
export const object = {
foo: <T extends Set<T> | []>(): void => { },
}; | {
"end_byte": 127,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/transpile/declarationSelfReferentialConstraint.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertToEsModule_import_propertyAccess.ts_0_706 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @target: esnext
// @Filename: /a.js
////const x = require("x").default;
////const a = require("b").c;
////const a = require("a").a;
////const [a, b] = require("c").d;
////const [a, b] = require("c").a; // Test that we avoid shadowing the earlier local variable 'a' from 'const [a,b] = d;'.
////x; a; b;
verify.codeFix({
description: "Convert to ES module",
newFileContent:
`import x from "x";
import { c as a } from "b";
import { a } from "a";
import { d } from "c";
const [a, b] = d;
import { a as _a } from "c";
const [a, b] = _a; // Test that we avoid shadowing the earlier local variable 'a' from 'const [a,b] = d;'.
x; a; b;`,
});
| {
"end_byte": 706,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertToEsModule_import_propertyAccess.ts"
} |
TypeScript/tests/cases/fourslash/extract-method11.ts_0_805 | /// <reference path='fourslash.ts' />
// Nonexhaustive list of things it should be illegal to be extract-method on
// * Import declarations
// * Super calls
// * Function body blocks
// * try/catch blocks
//// /*1a*/import * as x from 'y';/*1b*/
//// namespace N {
//// /*oka*/class C extends B {
//// constructor() {
//// /*2a*/super();/*2b*/
//// }
//// }/*okb*/
//// }
//// function f() /*3a*/{ return 0 }/*3b*/
//// try /*4a*/{ console.log }/*4b*/ catch (e) /*5a*/{ console.log; }/*5b*/
for (const m of ['1', '2', '3', '4', '5']) {
goTo.select(m + 'a', m + 'b');
verify.not.refactorAvailable('Extract Symbol');
}
// Verify we can still extract the entire class
goTo.select('oka', 'okb');
verify.refactorAvailable('Extract Symbol', 'function_scope_0');
| {
"end_byte": 805,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method11.ts"
} |
TypeScript/tests/cases/fourslash/completionsOverridingMethodDefaultExported.ts_0_903 | /// <reference path="fourslash.ts" />
// Issue #52662
// @filename: other.ts
//// export default class Other {}
// @filename: base.ts
//// import Other from "./other";
//// export class Base {
//// foo(): Other {
//// throw new Error("");
//// }
//// }
// @filename: derived.ts
//// import { Base } from "./base";
//// export class Derived extends Base {
//// /**/
//// }
verify.completions({
marker: "",
isNewIdentifierLocation: true,
preferences: {
includeCompletionsWithInsertText: true,
includeCompletionsWithClassMemberSnippets: true,
},
includes: [
{
name: "foo",
sortText: completion.SortText.LocationPriority,
filterText: "foo",
insertText: "foo(): Other {\n}",
hasAction: true,
source: completion.CompletionSource.ClassMemberSnippet,
}
],
}) | {
"end_byte": 903,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsOverridingMethodDefaultExported.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType_js8.ts_0_396 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: a.js
/////**
//// * @type {/*a*/Foo/*b*/}
//// */
goTo.file('a.js')
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to typedef",
actionDescription: "Extract to typedef",
newContent:
`/**
* @typedef {Foo} /*RENAME*/NewType
*/
/**
* @type {NewType}
*/`,
});
| {
"end_byte": 396,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType_js8.ts"
} |
TypeScript/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts_0_211 | /// <reference path='fourslash.ts'/>
////var x = {
//// /*1*/property: {}
////};
////
////x./*2*/property;
////
/////*3*/let {/*4*/property: pVar} = x;
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 211,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarFunctionPrototype.ts_0_3187 | /// <reference path="fourslash.ts"/>
// @Filename: foo.js
////function f() {}
////f.prototype.x = 0;
////f.y = 0;
////f.prototype.method = function () {};
////Object.defineProperty(f, 'staticProp', {
//// set: function() {},
//// get: function(){
//// }
////});
////Object.defineProperty(f.prototype, 'name', {
//// set: function() {},
//// get: function(){
//// }
////});
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "f",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "x",
"kind": "property"
},
{
"text": "y"
},
{
"text": "method",
"kind": "function"
},
{
"text": "staticProp",
"childItems": [
{
"text": "get",
"kind": "method"
},
{
"text": "set",
"kind": "method"
}
]
},
{
"text": "name",
"childItems": [
{
"text": "get",
"kind": "method"
},
{
"text": "set",
"kind": "method"
}
]
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "f",
"kind": "class"
}
]
},
{
"text": "f",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
},
{
"text": "x",
"kind": "property"
},
{
"text": "y"
},
{
"text": "method",
"kind": "function"
},
{
"text": "staticProp"
},
{
"text": "name"
}
],
"indent": 1
},
{
"text": "staticProp",
"childItems": [
{
"text": "get",
"kind": "method"
},
{
"text": "set",
"kind": "method"
}
],
"indent": 2
},
{
"text": "name",
"childItems": [
{
"text": "get",
"kind": "method"
},
{
"text": "set",
"kind": "method"
}
],
"indent": 2
}
]);
| {
"end_byte": 3187,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarFunctionPrototype.ts"
} |
TypeScript/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts_0_674 | /// <reference path='fourslash.ts'/>
////declare function f();
////declare function f(s: string);
////declare function f(s: string, b: boolean);
////declare function f(n: number, b: boolean);
////
////f(/**/
verify.signatureHelp({
marker: "",
overloadsCount: 4,
text: "f(): any",
parameterCount: 0,
argumentCount: 0,
});
edit.insert("x, ");
verify.signatureHelp({
overloadsCount: 4,
text: "f(s: string, b: boolean): any",
parameterCount: 2,
parameterName: "b",
parameterSpan: "b: boolean",
});
edit.insert("x, ");
verify.signatureHelp({
overloadsCount: 4,
text: "f(s: string, b: boolean): any",
parameterCount: 2,
});
| {
"end_byte": 674,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/signatureHelpOnOverloadsDifferentArity3.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts_0_135 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @Filename: a.js
////declare var v;
verify.baselineSyntacticDiagnostics();
| {
"end_byte": 135,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics12.ts"
} |
TypeScript/tests/cases/fourslash/completionsImport_keywords.ts_0_1477 | /// <reference path="fourslash.ts" />
// @Filename: /a.ts
////const _break = 0;
////export { _break as break };
////const _implements = 0;
////export { _implements as implements };
////const _unique = 0;
////export { _unique as unique };
// Note: `export const unique = 0;` is legal,
// but we want to test that we don't block an import completion of 'unique' just because it appears in an ExportSpecifier.
// @Filename: /b.ts
////br/*break*/
////im/*implements*/
////un/*unique*/
const preferences: FourSlashInterface.UserPreferences = { includeCompletionsForModuleExports: true };
verify.completions(
// no reserved words
{
marker: "break",
exact: completion.globals,
preferences,
},
// no strict mode reserved words
{
marker: "implements",
exact: completion.globals,
preferences,
},
// yes contextual keywords
{
marker: "unique",
unsorted: [
completion.globalThisEntry,
...completion.globalsVars,
completion.undefinedVarEntry,
{
name: "unique",
source: "/a",
sourceDisplay: "./a",
text: "(alias) const unique: 0\nexport unique",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions
},
...completion.globalKeywords.filter(e => e.name !== "unique"),
],
preferences,
},
);
| {
"end_byte": 1477,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsImport_keywords.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromFunctionThisUsageJsDocNewDocsLiteral.ts_0_719 | /// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @noImplicitThis: true
// @Filename: /consumesType.js
////function [|returnThisMember|]() {
//// return this.member;
////}
////
////const container = {
//// member: "sample",
//// returnThisMember: returnThisMember,
////};
////
////container.returnThisMember();
verify.codeFix({
description: "Infer 'this' type of 'returnThisMember' from usage",
index: 0,
newFileContent: `/**
* @this {{ member: string; returnThisMember: () => any; }}
*/
function returnThisMember() {
return this.member;
}
const container = {
member: "sample",
returnThisMember: returnThisMember,
};
container.returnThisMember();`
});
| {
"end_byte": 719,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromFunctionThisUsageJsDocNewDocsLiteral.ts"
} |
TypeScript/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts_0_266 | /// <reference path="fourslash.ts"/>
// @allowJs: true
// @Filename: a.js
////const foo = {
//// set: function (x) {
//// this._x = x;
//// },
//// copy: function ([|x|]) {
//// this._x = [|x|].prop;
//// }
////};
verify.baselineRename();
| {
"end_byte": 266,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsSpecialAssignmentRhs1.ts"
} |
TypeScript/tests/cases/fourslash/spaceAfterStatementConditions.ts_0_807 | /// <reference path="fourslash.ts"/>
////let i = 0;
////
////if(i<0) ++i;
////if(i<0) --i;
////
////while(i<0) ++i;
////while(i<0) --i;
////
////do ++i;
////while(i<0)
////do --i;
////while(i<0)
////
////for(let prop in { foo: 1 }) ++i;
////for(let prop in { foo: 1 }) --i;
////
////for(let foo of [1, 2]) ++i;
////for(let foo of [1, 2]) --i;
////
////for(let j = 0; j < 10; j++) ++i;
////for(let j = 0; j < 10; j++) --i;
////
format.document();
verify.currentFileContentIs(
`let i = 0;
if (i < 0) ++i;
if (i < 0) --i;
while (i < 0) ++i;
while (i < 0) --i;
do ++i;
while (i < 0)
do --i;
while (i < 0)
for (let prop in { foo: 1 }) ++i;
for (let prop in { foo: 1 }) --i;
for (let foo of [1, 2]) ++i;
for (let foo of [1, 2]) --i;
for (let j = 0; j < 10; j++) ++i;
for (let j = 0; j < 10; j++) --i;
`);
| {
"end_byte": 807,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/spaceAfterStatementConditions.ts"
} |
TypeScript/tests/cases/fourslash/publicBreak.ts_0_102 | /// <reference path="fourslash.ts" />
//// public break;
//// /**/
goTo.marker();
edit.insert(' ');
| {
"end_byte": 102,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/publicBreak.ts"
} |
TypeScript/tests/cases/fourslash/completionListInUnclosedFunction05.ts_3_251 | / <reference path="fourslash.ts" />
////function foo(x: string, y: number, z: boolean) {
//// function bar(a: number, b: string, c: typeof x = /*1*/
////}
verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b"]})
| {
"end_byte": 251,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionListInUnclosedFunction05.ts"
} |
TypeScript/tests/cases/fourslash/referencesForInheritedProperties.ts_0_430 | /// <reference path='fourslash.ts'/>
////interface interface1 {
//// /*1*/doStuff(): void;
////}
////
////interface interface2 extends interface1{
//// /*2*/doStuff(): void;
////}
////
////class class1 implements interface2 {
//// /*3*/doStuff() {
////
//// }
////}
////
////class class2 extends class1 {
////
////}
////
////var v: class2;
////v./*4*/doStuff();
verify.baselineFindAllReferences('1', '2', '3', '4')
| {
"end_byte": 430,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/referencesForInheritedProperties.ts"
} |
TypeScript/tests/cases/fourslash/extract-method40.ts_0_461 | /// <reference path='fourslash.ts' />
////const foo = /*start*/{
//// a: 1,
//// b: () => { return 1; }
////}/*end*/
goTo.select("start", "end");
edit.applyRefactor({
refactorName: "Extract Symbol",
actionName: "function_scope_0",
actionDescription: "Extract to function in global scope",
newContent:
`const foo = /*RENAME*/newFunction()
function newFunction() {
return {
a: 1,
b: () => { return 1; }
};
}
`
});
| {
"end_byte": 461,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/extract-method40.ts"
} |
TypeScript/tests/cases/fourslash/moveToFile_expandSelectionRange7.ts_0_333 | /// <reference path='fourslash.ts' />
//@Filename: /bar.ts
////
// @Filename: /a.ts
//// fun[|ction f() {
//// cons|]t a = 1;
//// }
verify.moveToFile({
newFileContents: {
"/a.ts":
``,
"/bar.ts":
`
function f() {
const a = 1;
}
`,
},
interactiveRefactorArguments: { targetFile: "/bar.ts" }
}); | {
"end_byte": 333,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToFile_expandSelectionRange7.ts"
} |
TypeScript/tests/cases/fourslash/inlineVariableRecursiveInitializer.ts_0_150 | /// <reference path="fourslash.ts" />
////const /*a*/foo/*b*/ = () => foo();
goTo.select("a", "b");
verify.not.refactorAvailable("Inline variable"); | {
"end_byte": 150,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/inlineVariableRecursiveInitializer.ts"
} |
TypeScript/tests/cases/fourslash/codeFixSpellingAddSpaces4.ts_0_903 | /// <reference path='fourslash.ts' />
// Repro for https://github.com/microsoft/TypeScript/issues/49557
////enum NamesWithSpaces {
//// "NoSpace",
//// "One Space",
//// "Has Two Spaces",
//// "This Has Three Spaces",
//// "And This Has Four Spaces",
////
//// "Block One",
//// "Block Two",
//// "Block Three",
////
//// "This Has Three Spaces_________________________________________________________",
//// "And This Has Four Spaces_________________________________________________________",
////}
////
//// NamesWithSpaces.[|ThisHasThreeSpaces_________________________________________________________|];
verify.codeFixAvailable([
{ description: "Change spelling to 'This Has Three Spaces_________________________________________________________'" },
{ description: "Add missing enum member 'ThisHasThreeSpaces_________________________________________________________'" },
]);
| {
"end_byte": 903,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixSpellingAddSpaces4.ts"
} |
TypeScript/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts_0_878 | /// <reference path="fourslash.ts"/>
////class Test {
//// constructor() {
//// }
////}
verify.navigationTree({
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "Test",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
}
]
}
]
});
verify.navigationBar([
{
"text": "<global>",
"kind": "script",
"childItems": [
{
"text": "Test",
"kind": "class"
}
]
},
{
"text": "Test",
"kind": "class",
"childItems": [
{
"text": "constructor",
"kind": "constructor"
}
],
"indent": 1
}
]);
| {
"end_byte": 878,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/navigationBarItemsEmptyConstructors.ts"
} |
TypeScript/tests/cases/fourslash/completionsPaths_importType.ts_0_1044 | /// <reference path="fourslash.ts" />
// @allowJs: true
// @moduleResolution: node
// @Filename: /ns.ts
////file content not read
// @Filename: /node_modules/package/index.ts
////file content not read
// @Filename: /usage.ts
////type A = typeof import("p/*1*/");
////type B = import(".//*2*/");
// @Filename: /user.js
/////** @type {import("/*3*/")} */
verify.completions(
{
marker: ["1", "3"],
exact: { name: "package", kind: "directory" },
isNewIdentifierLocation: true,
},
{
marker: "2",
exact: [
{ name: "lib", kind: "script", kindModifiers: ".d.ts" },
{ name: "lib.decorators", kind: "script", kindModifiers: ".d.ts" },
{ name: "lib.decorators.legacy", kind: "script", kindModifiers: ".d.ts" },
{ name: "ns", kind: "script", kindModifiers: ".ts" },
{ name: "user", kind: "script", kindModifiers: ".js" },
{ name: "node_modules", kind: "directory" },
],
isNewIdentifierLocation: true
},
);
| {
"end_byte": 1044,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsPaths_importType.ts"
} |
TypeScript/tests/cases/fourslash/completionsForRecursiveGenericTypesMember.ts_0_430 | /// <reference path="fourslash.ts" />
//// export class TestBase<T extends TestBase<T>>
//// {
//// public publicMethod(p: any): void {}
//// private privateMethod(p: any): void {}
//// protected protectedMethod(p: any): void {}
//// public test(t: T): void
//// {
//// t./**/
//// }
//// }
verify.completions({ marker: "", exact: ["privateMethod", "protectedMethod", "publicMethod", "test"] });
| {
"end_byte": 430,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionsForRecursiveGenericTypesMember.ts"
} |
TypeScript/tests/cases/fourslash/quickInfoCommentsFunctionExpression.ts_0_1206 | /// <reference path='fourslash.ts' />
// test arrow doc comments
/////** lambdaFoo var comment*/
////var lamb/*1*/daFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b;
////var lambddaN/*3*/oVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b;
////lambdaFoo(10, 20);
// test nested arrow doc comments
////function /*7*/anotherFunc(a: number) {
//// /** documentation
//// @param b {string} inner parameter */
//// var /*8*/lambdaVar = /** inner docs */(/*9*/b: string) => {
//// var /*10*/localVar = "Hello ";
//// return /*11*/localVar + /*12*/b;
//// }
//// return lamb/*13*/daVar("World") + a;
////}
// test function expression doc comments
/////**
//// * On variable
//// * @param s the first parameter!
//// * @returns the parameter's length
//// */
////var assi/*14*/gned = /**
//// * Summary on expression
//// * @param s param on expression
//// * @returns return on expression
//// */function(/** On parameter */s: string) {
//// return s.length;
////}
////assig/*16*/ned("hey");
verify.baselineQuickInfo()
| {
"end_byte": 1206,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/quickInfoCommentsFunctionExpression.ts"
} |
TypeScript/tests/cases/fourslash/renameJsExports03.ts_0_280 | /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: a.js
////class /*1*/A {
//// /*2*/constructor() { }
////}
////module.exports = A;
// @Filename: b.js
////const /*3*/A = require("./a");
////new /*4*/A;
verify.baselineFindAllReferences('1', '2', '3', '4')
| {
"end_byte": 280,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/renameJsExports03.ts"
} |
TypeScript/tests/cases/fourslash/jsSpecialAssignmentMerging.ts_0_471 | /// <reference path="fourslash.ts" />
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: b.d.ts
//// declare class C { }
// @Filename: a.js
//// C.prototype = { m: "q"; }
// @Filename: test.js
//// var c = new C()
//// /*1*/
//// var c = new C()
// #24015
// This failed with 13 and up on my machine, so 20 is 2**7 more than needed.
for (let i = 0; i < 20; i++) {
goTo.marker('1');
edit.insertLine('c');
verify.getSemanticDiagnostics([])
}
| {
"end_byte": 471,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsSpecialAssignmentMerging.ts"
} |
TypeScript/tests/cases/fourslash/formatEmptyBlock.ts_0_125 | /// <reference path='fourslash.ts' />
////{}
goTo.eof();
edit.insert("\n");
goTo.bof();
verify.currentLineContentIs("{ }"); | {
"end_byte": 125,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/formatEmptyBlock.ts"
} |
TypeScript/tests/cases/fourslash/moveToNewFile_bindingPatterns.ts_0_380 | /// <reference path='fourslash.ts' />
// @Filename: /a.ts
////[|export const [x, { p: y }] = [0, { p: 1 }];|]
// @Filename: /b.ts
////import { x, y } from "./a";
verify.noErrors();
verify.moveToNewFile({
newFileContents: {
"/a.ts": "",
"/x.ts":
`export const [x, { p: y }] = [0, { p: 1 }];
`,
"/b.ts":
`
import { x, y } from "./x";
`,
},
});
| {
"end_byte": 380,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/moveToNewFile_bindingPatterns.ts"
} |
TypeScript/tests/cases/fourslash/completionTypeGuard.ts_0_451 | /// <reference path="fourslash.ts" />
//// const x = "str";
//// function assert1(condition: any, msg?: string): /*1*/ ;
//// function assert2(condition: any, msg?: string): /*2*/ { }
//// function assert3(condition: any, msg?: string): /*3*/
//// hi
verify.completions({marker: "1", exact: completion.globalTypes});
verify.completions({marker: "2", exact: completion.globalTypes});
verify.completions({marker: "3", exact: completion.globalTypes});
| {
"end_byte": 451,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionTypeGuard.ts"
} |
TypeScript/tests/cases/fourslash/codeFixInferFromUsageFunctionExpression.ts_0_204 | /// <reference path='fourslash.ts' />
////var f = function ([|x |]) {
//// return x
////}
////f(1)
verify.rangeAfterCodeFix("x: number",/*includeWhiteSpace*/ undefined, /*errorCode*/ undefined, 0);
| {
"end_byte": 204,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixInferFromUsageFunctionExpression.ts"
} |
TypeScript/tests/cases/fourslash/addVarToConstructor1.ts_0_559 | /// <reference path="fourslash.ts" />
////
//// //_modes. // produces an internal error - please implement in derived class
////
//// module editor {
//// import modes = _modes;
////
//// var i : modes.IMode;
////
//// // If you just use p1:modes, the compiler accepts it - should be an error
//// class Bg {
//// constructor(p1: modes, p2: modes.Mode) {// should be an error on p2 - it's not exported
//// /*1*/}
////
//// }
//// }
////
edit.disableFormatting();
goTo.marker('1');
edit.insert(" var x:modes.Mode;\n");
| {
"end_byte": 559,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/addVarToConstructor1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertImport_namedToNamespaceStringLiteral.ts_0_640 | /// <reference path='fourslash.ts' />
/////*a*/import { "__<value>" as Value, "__<type>" as Type } from "foo";/*b*/
////export { Value, Type }; // Need a named import for this
////const foo: Type = Value;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert import",
actionName: "Convert named imports to namespace import",
actionDescription: "Convert named imports to namespace import",
newContent:
`import * as foo_1 from "foo";
import { "__<value>" as Value, "__<type>" as Type } from "foo";
export { Value, Type }; // Need a named import for this
const foo: foo_1["__<type>"] = foo_1["__<value>"];`,
});
| {
"end_byte": 640,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertImport_namedToNamespaceStringLiteral.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentOnListEnd.ts_3_179 | / <reference path='fourslash.ts'/>
////var a = []
/////*1*/
////| {}
/////*2*/
////| "";
goTo.marker("1");
verify.indentationIs(4)
goTo.marker("2");
verify.indentationIs(4) | {
"end_byte": 179,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentOnListEnd.ts"
} |
TypeScript/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile9.ts_0_514 | /// <reference path='fourslash.ts' />
// @allowjs: true
// @checkJs: true
// @noEmit: true
// @filename: a.js
////// @ts-check
////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": 514,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixDisableJsDiagnosticsInFile9.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_superCall.ts_0_670 | /// <reference path='fourslash.ts' />
////class A {
//// constructor(/*a*/a: string, b: string/*b*/) { }
////}
////class B extends A {
//// constructor(a: string, b: string, c: string) {
//// super(a, b);
//// }
////}
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert parameters to destructured object",
actionName: "Convert parameters to destructured object",
actionDescription: "Convert parameters to destructured object",
newContent: `class A {
constructor({ a, b }: { a: string; b: string; }) { }
}
class B extends A {
constructor(a: string, b: string, c: string) {
super({ a, b });
}
}`
}); | {
"end_byte": 670,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertParamsToDestructuredObject_superCall.ts"
} |
TypeScript/tests/cases/fourslash/jsDocFunctionSignatures6.ts_0_433 | ///<reference path="fourslash.ts" />
// @allowJs: true
// @Filename: Foo.js
/////**
//// * @param {string} p1 - A string param
//// * @param {string?} p2 - An optional param
//// * @param {string} [p3] - Another optional param
//// * @param {string} [p4="test"] - An optional param with a default value
//// */
////function f1(p1, p2, p3, p4){}
////f1(/*1*/'foo', /*2*/'bar', /*3*/'baz', /*4*/'qux');
verify.baselineSignatureHelp()
| {
"end_byte": 433,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsDocFunctionSignatures6.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType18.ts_0_389 | /// <reference path='fourslash.ts' />
//// type A<B, C, D = B> = /*a*/Partial<C | string>/*b*/ & D | C;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type /*RENAME*/NewType<C> = Partial<C | string>;
type A<B, C, D = B> = NewType<C> & D | C;`,
});
| {
"end_byte": 389,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType18.ts"
} |
TypeScript/tests/cases/fourslash/findAllReferencesDynamicImport1.ts_3_234 | / <reference path='fourslash.ts' />
// @Filename: foo.ts
//// export function foo() { return "foo"; }
//// /*1*/import("/*2*/./foo")
//// /*3*/var x = import("/*4*/./foo")
verify.baselineFindAllReferences('1', '2', '3', '4');
| {
"end_byte": 234,
"start_byte": 3,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/findAllReferencesDynamicImport1.ts"
} |
TypeScript/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Modifier.ts_0_419 | /// <reference path='fourslash.ts' />
//// export let foo = /*x*/a/*y*/ => {
//// let b = 1;
//// return a + b;
//// };
goTo.select("x", "y");
edit.applyRefactor({
refactorName: "Convert arrow function or function expression",
actionName: "Convert to named function",
actionDescription: "Convert to named function",
newContent: `export function foo(a) {
let b = 1;
return a + b;
}`,
});
| {
"end_byte": 419,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToNamed_Modifier.ts"
} |
TypeScript/tests/cases/fourslash/jsxElementExtendsNoCrash3.ts_0_121 | /// <reference path="fourslash.ts" />
// @filename: index.tsx
//// <T extends /=>
verify.getSuggestionDiagnostics([]);
| {
"end_byte": 121,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/jsxElementExtendsNoCrash3.ts"
} |
TypeScript/tests/cases/fourslash/getJavaScriptCompletions12.ts_0_1001 | ///<reference path="fourslash.ts" />
// @allowNonTsExtensions: true
// @Filename: Foo.js
/////**
//// * @param {number} input
//// * @param {string} currency
//// * @returns {number}
//// */
////var convert = function(input, currency) {
//// switch(currency./*1*/) {
//// case "USD":
//// input./*2*/;
//// case "EUR":
//// return "" + rateToUsd.EUR;
//// case "CNY":
//// return {} + rateToUsd.CNY;
//// }
////}
////convert(1, "")./*3*/
/////**
//// * @param {number} x
//// */
////var test1 = function(x) { return x./*4*/ }, test2 = function(a) { return a./*5*/ };
verify.completions(
{ marker: "1", includes: { name: "charCodeAt", kind: "method", kindModifiers: "declare" } },
{ marker: ["2", "3", "4"], includes: { name: "toExponential", kind: "method", kindModifiers: "declare" } },
{ marker: "5", includes: { name: "test1", kind: "warning", sortText: completion.SortText.JavascriptIdentifiers } },
);
| {
"end_byte": 1001,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/getJavaScriptCompletions12.ts"
} |
TypeScript/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-3.ts_0_452 | /// <reference path='fourslash.ts'/>
// @isolatedDeclarations: true
// @declaration: true
// @lib: es2019
// @Filename: /code.ts
////function foo(): void {}
////foo.x = 1;
////foo.y = 1;
verify.codeFix({
description: "Annotate types of properties expando function in a namespace",
index: 0,
newFileContent:
`function foo(): void {}
declare namespace foo {
export var x: number;
export var y: number;
}
foo.x = 1;
foo.y = 1;`
});
| {
"end_byte": 452,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/codeFixMissingTypeAnnotationOnExports43-expando-functions-3.ts"
} |
TypeScript/tests/cases/fourslash/completionForStringLiteralRelativeImportAllowJSFalse.ts_0_1484 | /// <reference path='fourslash.ts' />
// Should give completions for ts files only when allowJs is false.
// @Filename: test0.ts
//// import * as foo1 from "./*import_as0*/
//// import * as foo2 from ".//*import_as1*/
//// import * as foo4 from "./d1//*import_as2*/
//// import foo6 = require("./*import_equals0*/
//// import foo7 = require(".//*import_equals1*/
//// import foo9 = require("./d1//*import_equals2*/
//// var foo11 = require("./*require0*/
//// var foo12 = require(".//*require1*/
//// var foo14 = require("./d1//*require2*/
// @Filename: d2/d3/test1.ts
//// import * as foo16 from "..//*import_as3*/
//// import foo17 = require("..//*import_equals3*/
//// var foo18 = require("..//*require3*/
// @Filename: f1.ts
////
// @Filename: f2.js
////
// @Filename: f3.d.ts
////
// @Filename: f4.tsx
////
// @Filename: f5.js
////
// @Filename: f6.jsx
////
// @Filename: f7.ts
////
// @Filename: d1/f8.ts
////
// @Filename: d1/f9.ts
////
// @Filename: d2/f10.ts
////
// @Filename: d2/f11.ts
////
const kinds = ["import_as", "import_equals", "require"];
verify.completions(
{ marker: kinds.map(k => k + "0"), exact: [], isNewIdentifierLocation: true },
{ marker: kinds.map(k => k + "1"), exact: ["f1", "f3", "f4", "f7", "d1", "d2"], isNewIdentifierLocation: true },
{ marker: kinds.map(k => k + "2"), exact: ["f8", "f9"], isNewIdentifierLocation: true },
{ marker: kinds.map(k => k + "3"), exact: ["f10", "f11", "d3"], isNewIdentifierLocation: true },
);
| {
"end_byte": 1484,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/completionForStringLiteralRelativeImportAllowJSFalse.ts"
} |
TypeScript/tests/cases/fourslash/organizeImports7.ts_0_441 | /// <reference path="fourslash.ts" />
// Regression test for GH#43107
//// import * as something from "path"; /**
//// * some comment here
//// * and there
//// */
//// import * as somethingElse from "anotherpath";
////
//// something;
//// somethingElse;
verify.organizeImports(
`import * as somethingElse from "anotherpath";
import * as something from "path"; /**
* some comment here
* and there
*/
something;
somethingElse;`
); | {
"end_byte": 441,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/organizeImports7.ts"
} |
TypeScript/tests/cases/fourslash/autoImportTypeOnlyPreferred1.ts_0_932 | /// <reference path="fourslash.ts" />
// @verbatimModuleSyntax: true
// @module: esnext
// @moduleResolution: bundler
// @Filename: /ts.d.ts
//// declare namespace ts {
//// interface SourceFile {
//// text: string;
//// }
//// function createSourceFile(): SourceFile;
//// }
//// export = ts;
// @Filename: /types.ts
//// export interface VFS {
//// getSourceFile(path: string): ts/**/
//// }
verify.completions({
marker: "",
includes: [{
name: "ts",
source: "./ts",
sourceDisplay: "./ts",
hasAction: true,
sortText: completion.SortText.AutoImportSuggestions,
}],
preferences: {
includeCompletionsForModuleExports: true,
allowIncompleteCompletions: true,
},
}).andApplyCodeAction({
name: "ts",
source: "./ts",
description: `Add import from "./ts"`,
newFileContent: `import type ts from "./ts";
export interface VFS {
getSourceFile(path: string): ts
}`
});
| {
"end_byte": 932,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/autoImportTypeOnlyPreferred1.ts"
} |
TypeScript/tests/cases/fourslash/gotoDefinitionSatisfiesTag.ts_0_319 | ///<reference path="fourslash.ts" />
// @noEmit: true
// @allowJS: true
// @checkJs: true
// @filename: /a.js
/////**
//// * @typedef {Object} [|/*def*/T|]
//// * @property {number} a
//// */
////
/////** @satisfies {/*use*/[|T|]} comment */
////const foo = { a: 1 };
verify.baselineGetDefinitionAtPosition("use");
| {
"end_byte": 319,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/gotoDefinitionSatisfiesTag.ts"
} |
TypeScript/tests/cases/fourslash/refactorExtractType49.ts_0_432 | /// <reference path='fourslash.ts' />
//// type A<T extends string> = T;
//// type B<T extends string> = /*a*/A<T>/*b*/;
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Extract type",
actionName: "Extract to type alias",
actionDescription: "Extract to type alias",
newContent: `type A<T extends string> = T;
type /*RENAME*/NewType<T extends string> = A<T>;
type B<T extends string> = NewType<T>;`,
});
| {
"end_byte": 432,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/refactorExtractType49.ts"
} |
TypeScript/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts_0_108 | /// <reference path='fourslash.ts'/>
////function foo(a,
/////**/
goTo.marker();
verify.indentationIs(4);
| {
"end_byte": 108,
"start_byte": 0,
"url": "https://github.com/microsoft/TypeScript/blob/main/tests/cases/fourslash/smartIndentNonterminatedArgumentListAtEOF.ts"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.