Merge pull request #23893 from Microsoft/libReference

Adds 'lib' reference directives
This commit is contained in:
Ron Buckton
2018-06-04 16:14:52 -07:00
committed by GitHub
1559 changed files with 9715 additions and 9287 deletions
+8 -3
View File
@@ -11,6 +11,7 @@ const concat = require("gulp-concat");
const clone = require("gulp-clone");
const newer = require("gulp-newer");
const tsc = require("gulp-typescript");
const tsc_oop = require("./scripts/build/gulp-typescript-oop");
const insert = require("gulp-insert");
const sourcemaps = require("gulp-sourcemaps");
const Q = require("q");
@@ -412,6 +413,10 @@ function prependCopyright(outputCopyright = !useDebugMode) {
return insert.prepend(outputCopyright ? (copyrightContent || (copyrightContent = fs.readFileSync(copyright).toString())) : "");
}
function getCompilerPath(useBuiltCompiler) {
return useBuiltCompiler ? "./built/local/typescript.js" : "./lib/typescript.js";
}
gulp.task(builtLocalCompiler, /*help*/ false, [servicesFile], () => {
const localCompilerProject = tsc.createProject("src/compiler/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
return localCompilerProject.src()
@@ -424,7 +429,7 @@ gulp.task(builtLocalCompiler, /*help*/ false, [servicesFile], () => {
});
gulp.task(servicesFile, /*help*/ false, ["lib", "generate-diagnostics"], () => {
const servicesProject = tsc.createProject("src/services/tsconfig.json", getCompilerSettings({ removeComments: false }, /*useBuiltCompiler*/ false));
const servicesProject = tsc_oop.createProject("src/services/tsconfig.json", getCompilerSettings({ removeComments: false }), { typescript: getCompilerPath(/*useBuiltCompiler*/ false) });
const {js, dts} = servicesProject.src()
.pipe(newer(servicesFile))
.pipe(sourcemaps.init())
@@ -499,7 +504,7 @@ const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js")
const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile, typesMapJson], (done) => {
const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({ removeComments: false }, /*useBuiltCompiler*/ true));
const serverLibraryProject = tsc_oop.createProject("src/server/tsconfig.library.json", getCompilerSettings({ removeComments: false }), { typescript: getCompilerPath(/*useBuiltCompiler*/ true) });
/** @type {{ js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream }} */
const {js, dts} = serverLibraryProject.src()
.pipe(sourcemaps.init())
@@ -590,7 +595,7 @@ gulp.task("LKG", "Makes a new LKG out of the built js files", ["clean", "dontUse
// Task to build the tests infrastructure using the built compiler
const run = path.join(builtLocalDirectory, "run.js");
gulp.task(run, /*help*/ false, [servicesFile, tsserverLibraryFile], () => {
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
const testProject = tsc_oop.createProject("src/harness/tsconfig.json", getCompilerSettings({}), { typescript: getCompilerPath(/*useBuiltCompiler*/ true) });
return testProject.src()
.pipe(newer(run))
.pipe(sourcemaps.init())
+88
View File
@@ -0,0 +1,88 @@
// @ts-check
const path = require("path");
const child_process = require("child_process");
const tsc = require("gulp-typescript");
const Vinyl = require("vinyl");
const { Duplex, Readable } = require("stream");
/**
* @param {string} tsConfigFileName
* @param {tsc.Settings} settings
* @param {Object} options
* @param {string} [options.typescript]
*/
function createProject(tsConfigFileName, settings, options) {
settings = { ...settings };
options = { ...options };
if (settings.typescript) throw new Error();
const localSettings = { ...settings };
if (options.typescript) {
options.typescript = path.resolve(options.typescript);
localSettings.typescript = require(options.typescript);
}
const project = tsc.createProject(tsConfigFileName, localSettings);
const wrappedProject = /** @type {tsc.Project} */(() => {
const proc = child_process.fork(require.resolve("./main.js"));
/** @type {Duplex & { js?: Readable, dts?: Readable }} */
const compileStream = new Duplex({
objectMode: true,
read() {},
/** @param {*} file */
write(file, encoding, callback) {
proc.send({ method: "write", params: { path: file.path, cwd: file.cwd, base: file.base }});
callback();
},
final(callback) {
proc.send({ method: "final" });
callback();
}
});
const jsStream = compileStream.js = new Readable({
objectMode: true,
read() {}
});
const dtsStream = compileStream.dts = new Readable({
objectMode: true,
read() {}
});
proc.send({ method: "createProject", params: { tsConfigFileName, settings, options } });
proc.on("message", ({ method, params }) => {
if (method === "write") {
const file = new Vinyl({
path: params.path,
cwd: params.cwd,
base: params.base,
contents: Buffer.from(params.contents, "utf8")
});
if (params.sourceMap) file.sourceMap = params.sourceMap
compileStream.push(file);;
if (file.path.endsWith(".d.ts")) {
dtsStream.push(file);
}
else {
jsStream.push(file);
}
}
else if (method === "final") {
compileStream.push(null);
jsStream.push(null);
dtsStream.push(null);
proc.kill();
}
else if (method === "error") {
const error = new Error();
error.name = params.name;
error.message = params.message;
error.stack = params.stack;
compileStream.emit("error", error);
proc.kill();
}
});
return /** @type {*} */(compileStream);
});
return Object.assign(wrappedProject, project);
}
exports.createProject = createProject;
+91
View File
@@ -0,0 +1,91 @@
// @ts-check
const path = require("path");
const fs = require("fs");
const tsc = require("gulp-typescript");
const Vinyl = require("vinyl");
const { Readable, Writable } = require("stream");
/** @type {tsc.Project} */
let project;
/** @type {Readable} */
let inputStream;
/** @type {Writable} */
let outputStream;
/** @type {tsc.CompileStream} */
let compileStream;
process.on("message", ({ method, params }) => {
try {
if (method === "createProject") {
const { tsConfigFileName, settings, options } = params;
if (options.typescript) {
settings.typescript = require(options.typescript);
}
project = tsc.createProject(tsConfigFileName, settings);
inputStream = new Readable({
objectMode: true,
read() {}
});
outputStream = new Writable({
objectMode: true,
/**
* @param {*} file
*/
write(file, encoding, callback) {
process.send({
method: "write",
params: {
path: file.path,
cwd: file.cwd,
base: file.base,
contents: file.contents.toString(),
sourceMap: file.sourceMap
}
});
callback();
},
final(callback) {
process.send({ method: "final" });
callback();
}
});
outputStream.on("error", error => {
process.send({
method: "error",
params: {
name: error.name,
message: error.message,
stack: error.stack
}
});
});
compileStream = project();
inputStream.pipe(compileStream).pipe(outputStream);
}
else if (method === "write") {
const file = new Vinyl({
path: params.path,
cwd: params.cwd,
base: params.base
});
file.contents = fs.readFileSync(file.path);
inputStream.push(/** @type {*} */(file));
}
else if (method === "final") {
inputStream.push(null);
}
}
catch (e) {
process.send({
method: "error",
params: {
name: e.name,
message: e.message,
stack: e.stack
}
});
}
});
+3 -80
View File
@@ -17382,88 +17382,11 @@ namespace ts {
* and 1 insertion/deletion at 3 characters)
*/
function getSpellingSuggestionForName(name: string, symbols: Symbol[], meaning: SymbolFlags): Symbol | undefined {
const maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
let bestDistance = Math.floor(name.length * 0.4) + 1; // If the best result isn't better than this, don't bother.
let bestCandidate: Symbol | undefined;
let justCheckExactMatches = false;
const nameLowerCase = name.toLowerCase();
for (const candidate of symbols) {
return getSpellingSuggestion(name, symbols, getCandidateName);
function getCandidateName(candidate: Symbol) {
const candidateName = symbolName(candidate);
if (candidateName.charCodeAt(0) === CharacterCodes.doubleQuote
|| !(candidate.flags & meaning && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference)) {
continue;
}
const candidateNameLowerCase = candidateName.toLowerCase();
if (candidateNameLowerCase === nameLowerCase) {
return candidate;
}
if (justCheckExactMatches) {
continue;
}
if (candidateName.length < 3) {
// Don't bother, user would have noticed a 2-character name having an extra character
continue;
}
// Only care about a result better than the best so far.
const distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1);
if (distance === undefined) {
continue;
}
if (distance < 3) {
justCheckExactMatches = true;
bestCandidate = candidate;
}
else {
Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
return !startsWith(candidateName, "\"") && candidate.flags & meaning ? candidateName : undefined;
}
return bestCandidate;
}
function levenshteinWithMax(s1: string, s2: string, max: number): number | undefined {
let previous = new Array(s2.length + 1);
let current = new Array(s2.length + 1);
/** Represents any value > max. We don't care about the particular value. */
const big = max + 1;
for (let i = 0; i <= s2.length; i++) {
previous[i] = i;
}
for (let i = 1; i <= s1.length; i++) {
const c1 = s1.charCodeAt(i - 1);
const minJ = i > max ? i - max : 1;
const maxJ = s2.length > max + i ? max + i : s2.length;
current[0] = i;
/** Smallest value of the matrix in the ith column. */
let colMin = i;
for (let j = 1; j < minJ; j++) {
current[j] = big;
}
for (let j = minJ; j <= maxJ; j++) {
const dist = c1 === s2.charCodeAt(j - 1)
? previous[j - 1]
: Math.min(/*delete*/ previous[j] + 1, /*insert*/ current[j - 1] + 1, /*substitute*/ previous[j - 1] + 2);
current[j] = dist;
colMin = Math.min(colMin, dist);
}
for (let j = maxJ + 1; j <= s2.length; j++) {
current[j] = big;
}
if (colMin > max) {
// Give up -- everything in this column is > max and it can't get better in future columns.
return undefined;
}
const temp = previous;
previous = current;
current = temp;
}
const res = previous[s2.length];
return res > max ? undefined : res;
}
function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) {
+61 -38
View File
@@ -1,6 +1,66 @@
namespace ts {
/* @internal */
export const compileOnSaveCommandLineOption: CommandLineOption = { name: "compileOnSave", type: "boolean" };
// NOTE: The order here is important to default lib ordering as entries will have the same
// order in the generated program (see `getDefaultLibPriority` in program.ts). This
// order also affects overload resolution when a type declared in one lib is
// augmented in another lib.
const libEntries: [string, string][] = [
// JavaScript only
["es5", "lib.es5.d.ts"],
["es6", "lib.es2015.d.ts"],
["es2015", "lib.es2015.d.ts"],
["es7", "lib.es2016.d.ts"],
["es2016", "lib.es2016.d.ts"],
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
["dom.iterable", "lib.dom.iterable.d.ts"],
["webworker", "lib.webworker.d.ts"],
["webworker.importscripts", "lib.webworker.importscripts.d.ts"],
["scripthost", "lib.scripthost.d.ts"],
// ES2015 Or ESNext By-feature options
["es2015.core", "lib.es2015.core.d.ts"],
["es2015.collection", "lib.es2015.collection.d.ts"],
["es2015.generator", "lib.es2015.generator.d.ts"],
["es2015.iterable", "lib.es2015.iterable.d.ts"],
["es2015.promise", "lib.es2015.promise.d.ts"],
["es2015.proxy", "lib.es2015.proxy.d.ts"],
["es2015.reflect", "lib.es2015.reflect.d.ts"],
["es2015.symbol", "lib.es2015.symbol.d.ts"],
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
["es2016.array.include", "lib.es2016.array.include.d.ts"],
["es2017.object", "lib.es2017.object.d.ts"],
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
["es2017.string", "lib.es2017.string.d.ts"],
["es2017.intl", "lib.es2017.intl.d.ts"],
["es2017.typedarrays", "lib.es2017.typedarrays.d.ts"],
["es2018.intl", "lib.es2018.intl.d.ts"],
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["esnext.array", "lib.esnext.array.d.ts"],
["esnext.symbol", "lib.esnext.symbol.d.ts"],
["esnext.asynciterable", "lib.esnext.asynciterable.d.ts"],
];
/**
* An array of supported "lib" reference file names used to determine the order for inclusion
* when referenced, as well as for spelling suggestions. This ensures the correct ordering for
* overload resolution when a type declared in one lib is extended by another.
*/
/* @internal */
export const libs = libEntries.map(entry => entry[0]);
/**
* A map of lib names to lib files. This map is used both for parsing the "lib" command line
* option as well as for resolving lib reference directives.
*/
/* @internal */
export const libMap = createMapFromEntries(libEntries);
/* @internal */
export const optionDeclarations: CommandLineOption[] = [
// CommandLine only options
@@ -114,44 +174,7 @@ namespace ts {
type: "list",
element: {
name: "lib",
type: createMapFromTemplate({
// JavaScript only
"es5": "lib.es5.d.ts",
"es6": "lib.es2015.d.ts",
"es2015": "lib.es2015.d.ts",
"es7": "lib.es2016.d.ts",
"es2016": "lib.es2016.d.ts",
"es2017": "lib.es2017.d.ts",
"es2018": "lib.es2018.d.ts",
"esnext": "lib.esnext.d.ts",
// Host only
"dom": "lib.dom.d.ts",
"dom.iterable": "lib.dom.iterable.d.ts",
"webworker": "lib.webworker.d.ts",
"scripthost": "lib.scripthost.d.ts",
// ES2015 Or ESNext By-feature options
"es2015.core": "lib.es2015.core.d.ts",
"es2015.collection": "lib.es2015.collection.d.ts",
"es2015.generator": "lib.es2015.generator.d.ts",
"es2015.iterable": "lib.es2015.iterable.d.ts",
"es2015.promise": "lib.es2015.promise.d.ts",
"es2015.proxy": "lib.es2015.proxy.d.ts",
"es2015.reflect": "lib.es2015.reflect.d.ts",
"es2015.symbol": "lib.es2015.symbol.d.ts",
"es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts",
"es2016.array.include": "lib.es2016.array.include.d.ts",
"es2017.object": "lib.es2017.object.d.ts",
"es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts",
"es2017.string": "lib.es2017.string.d.ts",
"es2017.intl": "lib.es2017.intl.d.ts",
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
"es2018.intl": "lib.es2018.intl.d.ts",
"es2018.promise": "lib.es2018.promise.d.ts",
"es2018.regexp": "lib.es2018.regexp.d.ts",
"esnext.array": "lib.esnext.array.d.ts",
"esnext.symbol": "lib.esnext.symbol.d.ts",
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
}),
type: libMap
},
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
+107 -2
View File
@@ -59,6 +59,14 @@ namespace ts {
return result;
}
export function createMapFromEntries<T>(entries: [string, T][]): Map<T> {
const map = createMap<T>();
for (const [key, value] of entries) {
map.set(key, value);
}
return map;
}
export function createMapFromTemplate<T>(template: MapLike<T>): Map<T> {
const map: Map<T> = new MapCtr<T>();
@@ -1796,7 +1804,7 @@ namespace ts {
* Case-insensitive comparisons compare both strings one code-point at a time using the integer
* value of each code-point after applying `toUpperCase` to each string. We always map both
* strings to their upper-case form as some unicode characters do not properly round-trip to
* lowercase (such as `` (German sharp capital s)).
* lowercase (such as `ẞ` (German sharp capital s)).
*/
export function compareStringsCaseInsensitive(a: string, b: string) {
if (a === b) return Comparison.EqualTo;
@@ -1868,7 +1876,7 @@ namespace ts {
//
// For case insensitive comparisons we always map both strings to their
// upper-case form as some unicode characters do not properly round-trip to
// lowercase (such as `` (German sharp capital s)).
// lowercase (such as `ẞ` (German sharp capital s)).
return (a, b) => compareWithCallback(a, b, compareDictionaryOrder);
function compareDictionaryOrder(a: string, b: string) {
@@ -1993,6 +2001,103 @@ namespace ts {
return text1 ? Comparison.GreaterThan : Comparison.LessThan;
}
/**
* Given a name and a list of names that are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not Levenshtein distance.
*
* If there is a candidate that's the same except for case, return that.
* If there is a candidate that's within one edit of the name, return that.
* Otherwise, return the candidate with the smallest Levenshtein distance,
* except for candidates:
* * With no name
* * Whose length differs from the target name by more than 0.34 of the length of the name.
* * Whose levenshtein distance is more than 0.4 of the length of the name
* (0.4 allows 1 substitution/transposition for every 5 characters,
* and 1 insertion/deletion at 3 characters)
*/
export function getSpellingSuggestion<T>(name: string, candidates: T[], getName: (candidate: T) => string | undefined): T | undefined {
const maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
let bestDistance = Math.floor(name.length * 0.4) + 1; // If the best result isn't better than this, don't bother.
let bestCandidate: T | undefined;
let justCheckExactMatches = false;
const nameLowerCase = name.toLowerCase();
for (const candidate of candidates) {
const candidateName = getName(candidate);
if (candidateName !== undefined && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference) {
const candidateNameLowerCase = candidateName.toLowerCase();
if (candidateNameLowerCase === nameLowerCase) {
return candidate;
}
if (justCheckExactMatches) {
continue;
}
if (candidateName.length < 3) {
// Don't bother, user would have noticed a 2-character name having an extra character
continue;
}
// Only care about a result better than the best so far.
const distance = levenshteinWithMax(nameLowerCase, candidateNameLowerCase, bestDistance - 1);
if (distance === undefined) {
continue;
}
if (distance < 3) {
justCheckExactMatches = true;
bestCandidate = candidate;
}
else {
Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
}
}
return bestCandidate;
}
function levenshteinWithMax(s1: string, s2: string, max: number): number | undefined {
let previous = new Array(s2.length + 1);
let current = new Array(s2.length + 1);
/** Represents any value > max. We don't care about the particular value. */
const big = max + 1;
for (let i = 0; i <= s2.length; i++) {
previous[i] = i;
}
for (let i = 1; i <= s1.length; i++) {
const c1 = s1.charCodeAt(i - 1);
const minJ = i > max ? i - max : 1;
const maxJ = s2.length > max + i ? max + i : s2.length;
current[0] = i;
/** Smallest value of the matrix in the ith column. */
let colMin = i;
for (let j = 1; j < minJ; j++) {
current[j] = big;
}
for (let j = minJ; j <= maxJ; j++) {
const dist = c1 === s2.charCodeAt(j - 1)
? previous[j - 1]
: Math.min(/*delete*/ previous[j] + 1, /*insert*/ current[j - 1] + 1, /*substitute*/ previous[j - 1] + 2);
current[j] = dist;
colMin = Math.min(colMin, dist);
}
for (let j = maxJ + 1; j <= s2.length; j++) {
current[j] = big;
}
if (colMin > max) {
// Give up -- everything in this column is > max and it can't get better in future columns.
return undefined;
}
const temp = previous;
previous = current;
current = temp;
}
const res = previous[s2.length];
return res > max ? undefined : res;
}
export function getEmitScriptTarget(compilerOptions: CompilerOptions) {
return compilerOptions.target || ScriptTarget.ES3;
}
+8
View File
@@ -2369,6 +2369,14 @@
"category": "Error",
"code": 2725
},
"Cannot find lib definition for '{0}'.": {
"category": "Error",
"code": 2726
},
"Cannot find lib definition for '{0}'. Did you mean '{1}'?": {
"category": "Error",
"code": 2727
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
+3 -1
View File
@@ -2432,12 +2432,13 @@ namespace ts {
// Top-level nodes
export function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean) {
export function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean, libReferences?: SourceFile["libReferenceDirectives"]) {
if (
node.statements !== statements ||
(isDeclarationFile !== undefined && node.isDeclarationFile !== isDeclarationFile) ||
(referencedFiles !== undefined && node.referencedFiles !== referencedFiles) ||
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)
) {
const updated = <SourceFile>createSynthesizedNode(SyntaxKind.SourceFile);
@@ -2451,6 +2452,7 @@ namespace ts {
updated.referencedFiles = referencedFiles === undefined ? node.referencedFiles : referencedFiles;
updated.typeReferenceDirectives = typeReferences === undefined ? node.typeReferenceDirectives : typeReferences;
updated.hasNoDefaultLib = hasNoDefaultLib === undefined ? node.hasNoDefaultLib : hasNoDefaultLib;
updated.libReferenceDirectives = libReferences === undefined ? node.libReferenceDirectives : libReferences;
if (node.amdDependencies !== undefined) updated.amdDependencies = node.amdDependencies;
if (node.moduleName !== undefined) updated.moduleName = node.moduleName;
if (node.languageVariant !== undefined) updated.languageVariant = node.languageVariant;
+6
View File
@@ -7659,6 +7659,7 @@ namespace ts {
checkJsDirective?: CheckJsDirective;
referencedFiles: FileReference[];
typeReferenceDirectives: FileReference[];
libReferenceDirectives: FileReference[];
amdDependencies: AmdDependency[];
hasNoDefaultLib?: boolean;
moduleName?: string;
@@ -7712,6 +7713,7 @@ namespace ts {
context.checkJsDirective = undefined;
context.referencedFiles = [];
context.typeReferenceDirectives = [];
context.libReferenceDirectives = [];
context.amdDependencies = [];
context.hasNoDefaultLib = false;
context.pragmas!.forEach((entryOrList, key) => { // TODO: GH#18217
@@ -7721,6 +7723,7 @@ namespace ts {
case "reference": {
const referencedFiles = context.referencedFiles;
const typeReferenceDirectives = context.typeReferenceDirectives;
const libReferenceDirectives = context.libReferenceDirectives;
forEach(toArray(entryOrList), (arg: PragmaPsuedoMap["reference"]) => {
// TODO: GH#18217
if (arg!.arguments["no-default-lib"]) {
@@ -7729,6 +7732,9 @@ namespace ts {
else if (arg!.arguments.types) {
typeReferenceDirectives.push({ pos: arg!.arguments.types!.pos, end: arg!.arguments.types!.end, fileName: arg!.arguments.types!.value });
}
else if (arg!.arguments.lib) {
libReferenceDirectives.push({ pos: arg!.arguments.lib!.pos, end: arg!.arguments.lib!.end, fileName: arg!.arguments.lib!.value });
}
else if (arg!.arguments.path) {
referencedFiles.push({ pos: arg!.arguments.path!.pos, end: arg!.arguments.path!.end, fileName: arg!.arguments.path!.value });
}
Executable → Regular
+75 -18
View File
@@ -520,7 +520,9 @@ namespace ts {
let { oldProgram } = createProgramOptions;
let program: Program;
let files: SourceFile[] = [];
let processingDefaultLibFiles: SourceFile[] | undefined;
let processingOtherFiles: SourceFile[] | undefined;
let files: SourceFile[];
let commonSourceDirectory: string;
let diagnosticsProducingTypeChecker: TypeChecker;
let noDiagnosticsTypeChecker: TypeChecker;
@@ -620,7 +622,7 @@ namespace ts {
if (parsedRef) {
if (parsedRef.commandLine.options.outFile) {
const dtsOutfile = changeExtension(parsedRef.commandLine.options.outFile, ".d.ts");
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*packageId*/ undefined);
processSourceFile(dtsOutfile, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined);
}
addProjectReferenceRedirects(parsedRef.commandLine, projectReferenceRedirects);
}
@@ -630,7 +632,9 @@ namespace ts {
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
const structuralIsReused = tryReuseStructureFromOldProgram();
if (structuralIsReused !== StructureIsReused.Completely) {
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
processingDefaultLibFiles = [];
processingOtherFiles = [];
forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false));
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
const typeReferences: string[] = getAutomaticTypeDirectiveNames(options, host);
@@ -654,16 +658,19 @@ namespace ts {
// otherwise, using options specified in '--lib' instead of '--target' default library file
const defaultLibraryFileName = getDefaultLibraryFileName();
if (!options.lib && defaultLibraryFileName) {
processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true);
processRootFile(defaultLibraryFileName, /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false);
}
else {
forEach(options.lib, libFileName => {
processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true);
processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ false);
});
}
}
missingFilePaths = arrayFrom(filesByName.keys(), p => <Path>p).filter(p => !filesByName.get(p));
files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
processingDefaultLibFiles = undefined;
processingOtherFiles = undefined;
}
Debug.assert(!!missingFilePaths);
@@ -711,6 +718,7 @@ namespace ts {
isSourceFileDefaultLibrary,
dropDiagnosticsProducingTypeChecker,
getSourceFileFromReference,
getLibFileFromReference,
sourceFileToPackageName,
redirectTargetsSet,
isEmittedFile,
@@ -725,6 +733,21 @@ namespace ts {
return program;
function compareDefaultLibFiles(a: SourceFile, b: SourceFile) {
return compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b));
}
function getDefaultLibFilePriority(a: SourceFile) {
if (containsPath(defaultLibraryPath, a.fileName, /*ignoreCase*/ false)) {
const basename = getBaseFileName(a.fileName);
if (basename === "lib.d.ts" || basename === "lib.es6.d.ts") return 0;
const name = removeSuffix(removePrefix(basename, "lib."), ".d.ts");
const index = libs.indexOf(name);
if (index !== -1) return index + 1;
}
return libs.length + 2;
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string): ResolvedModuleWithFailedLookupLocations | undefined {
return moduleResolutionCache && resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache);
}
@@ -1047,6 +1070,11 @@ namespace ts {
if (fileChanged) {
// The `newSourceFile` object was created for the new program.
if (!arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
return oldProgram.structureIsReused = StructureIsReused.Not;
}
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
// value of no-default-lib has changed
// this will affect if default library is injected into the list of files
@@ -1708,8 +1736,8 @@ namespace ts {
return configFileParsingDiagnostics || emptyArray;
}
function processRootFile(fileName: string, isDefaultLib: boolean) {
processSourceFile(normalizePath(fileName), isDefaultLib, /*packageId*/ undefined);
function processRootFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean) {
processSourceFile(normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, /*packageId*/ undefined);
}
function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean {
@@ -1830,6 +1858,14 @@ namespace ts {
}
}
function getLibFileFromReference(ref: FileReference) {
const libName = ref.fileName.toLocaleLowerCase();
const libFileName = libMap.get(libName);
if (libFileName) {
return getSourceFile(combinePaths(defaultLibraryPath, libFileName));
}
}
/** This should have similar behavior to 'processSourceFile' without diagnostics or mutation. */
function getSourceFileFromReference(referencingFile: SourceFile, ref: FileReference): SourceFile | undefined {
return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), fileName => filesByName.get(toPath(fileName)));
@@ -1880,9 +1916,9 @@ namespace ts {
}
/** This has side effects through `findSourceFile`. */
function processSourceFile(fileName: string, isDefaultLib: boolean, packageId: PackageId | undefined, refFile?: SourceFile, refPos?: number, refEnd?: number): void {
function processSourceFile(fileName: string, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, packageId: PackageId | undefined, refFile?: SourceFile, refPos?: number, refEnd?: number): void {
getSourceFileFromReferenceWorker(fileName,
fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, refFile!, refPos!, refEnd!, packageId), // TODO: GH#18217
fileName => findSourceFile(fileName, toPath(fileName), isDefaultLib, ignoreNoDefaultLib, refFile!, refPos!, refEnd!, packageId), // TODO: GH#18217
(diagnostic, ...args) => {
fileProcessingDiagnostics.add(refFile !== undefined && refEnd !== undefined && refPos !== undefined
? createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...args)
@@ -1920,7 +1956,7 @@ namespace ts {
}
// Get source file from normalized fileName
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, refFile: SourceFile, refPos: number, refEnd: number, packageId: PackageId | undefined): SourceFile | undefined {
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: SourceFile, refPos: number, refEnd: number, packageId: PackageId | undefined): SourceFile | undefined {
if (filesByName.has(path)) {
const file = filesByName.get(path);
// try to check if we've already seen this file but with a different casing in path
@@ -1938,6 +1974,8 @@ namespace ts {
processTypeReferenceDirectives(file);
}
processLibReferenceDirectives(file);
modulesWithElidedImports.set(file.path, false);
processImportedModules(file);
}
@@ -1988,7 +2026,7 @@ namespace ts {
redirectTargetsSet.set(fileFromPackageId.path, true);
filesByName.set(path, dupFile);
sourceFileToPackageName.set(path, packageId.name);
files.push(dupFile);
processingOtherFiles!.push(dupFile);
return dupFile;
}
else if (file) {
@@ -2019,21 +2057,23 @@ namespace ts {
}
}
skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib;
skipDefaultLib = skipDefaultLib || (file.hasNoDefaultLib && !ignoreNoDefaultLib);
if (!options.noResolve) {
processReferencedFiles(file, isDefaultLib);
processTypeReferenceDirectives(file);
}
processLibReferenceDirectives(file);
// always process imported modules to record module name resolutions
processImportedModules(file);
if (isDefaultLib) {
files.unshift(file);
processingDefaultLibFiles!.push(file);
}
else {
files.push(file);
processingOtherFiles!.push(file);
}
}
@@ -2060,7 +2100,7 @@ namespace ts {
function processReferencedFiles(file: SourceFile, isDefaultLib: boolean) {
forEach(file.referencedFiles, ref => {
const referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib, /*packageId*/ undefined, file, ref.pos, ref.end);
processSourceFile(referencedFileName, isDefaultLib, /*ignoreNoDefaultLib*/ false, /*packageId*/ undefined, file, ref.pos, ref.end);
});
}
@@ -2095,7 +2135,7 @@ namespace ts {
if (resolvedTypeReferenceDirective) {
if (resolvedTypeReferenceDirective.primary) {
// resolved from the primary path
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); // TODO: GH#18217
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); // TODO: GH#18217
}
else {
// If we already resolved to this file, it must have been a secondary reference. Check file contents
@@ -2118,7 +2158,7 @@ namespace ts {
}
else {
// First resolution of this library
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd);
processSourceFile(resolvedTypeReferenceDirective.resolvedFileName!, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd);
}
}
}
@@ -2131,6 +2171,23 @@ namespace ts {
}
}
function processLibReferenceDirectives(file: SourceFile) {
forEach(file.libReferenceDirectives, libReference => {
const libName = libReference.fileName.toLocaleLowerCase();
const libFileName = libMap.get(libName);
if (libFileName) {
// we ignore any 'no-default-lib' reference set on this file.
processRootFile(combinePaths(defaultLibraryPath, libFileName), /*isDefaultLib*/ true, /*ignoreNoDefaultLib*/ true);
}
else {
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
const message = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
fileProcessingDiagnostics.add(createDiagnostic(file, libReference.pos, libReference.end, message, libName, suggestion));
}
});
}
function createDiagnostic(refFile: SourceFile, refPos: number, refEnd: number, message: DiagnosticMessage, ...args: any[]): Diagnostic {
if (refFile === undefined || refPos === undefined || refEnd === undefined) {
return createCompilerDiagnostic(message, ...args);
@@ -2191,7 +2248,7 @@ namespace ts {
else if (shouldAddFile) {
const path = toPath(resolvedFileName);
const pos = skipTrivia(file.text, file.imports[i].pos);
findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, file, pos, file.imports[i].end, resolution.packageId);
findSourceFile(resolvedFileName, path, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, file, pos, file.imports[i].end, resolution.packageId);
}
if (isFromNodeModulesSearch) {
+2 -2
View File
@@ -171,12 +171,12 @@ namespace ts {
[createModifier(SyntaxKind.DeclareKeyword)],
createLiteral(getResolvedExternalModuleName(context.getEmitHost(), sourceFile)),
createModuleBlock(setTextRange(createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements))
)], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false);
)], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
const updated = visitNodes(sourceFile.statements, visitDeclarationStatements);
return updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false);
return updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}
), mapDefined(node.prepends, prepend => {
if (prepend.kind === SyntaxKind.InputFiles) {
+19 -10
View File
@@ -2565,6 +2565,7 @@ namespace ts {
moduleName?: string;
referencedFiles: ReadonlyArray<FileReference>;
typeReferenceDirectives: ReadonlyArray<FileReference>;
libReferenceDirectives: ReadonlyArray<FileReference>;
languageVariant: LanguageVariant;
isDeclarationFile: boolean;
@@ -2785,6 +2786,7 @@ namespace ts {
/* @internal */ structureIsReused?: StructureIsReused;
/* @internal */ getSourceFileFromReference(referencingFile: SourceFile, ref: FileReference): SourceFile | undefined;
/* @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined;
/** Given a source file, get the name of the package it was imported from. */
/* @internal */ sourceFileToPackageName: Map<string>;
@@ -5454,8 +5456,12 @@ namespace ts {
}
/* @internal */
export interface PragmaDefinition<T1 extends string = string, T2 extends string = string, T3 extends string = string> {
args?: [PragmaArgumentSpecification<T1>] | [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>] | [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>, PragmaArgumentSpecification<T3>];
export interface PragmaDefinition<T1 extends string = string, T2 extends string = string, T3 extends string = string, T4 extends string = string> {
args?:
| [PragmaArgumentSpecification<T1>]
| [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>]
| [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>, PragmaArgumentSpecification<T3>]
| [PragmaArgumentSpecification<T1>, PragmaArgumentSpecification<T2>, PragmaArgumentSpecification<T3>, PragmaArgumentSpecification<T4>];
// If not present, defaults to PragmaKindFlags.Default
kind?: PragmaKindFlags;
}
@@ -5464,7 +5470,7 @@ namespace ts {
* This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
*/
/* @internal */
function _contextuallyTypePragmas<T extends {[name: string]: PragmaDefinition<K1, K2, K3>}, K1 extends string, K2 extends string, K3 extends string>(args: T): T {
function _contextuallyTypePragmas<T extends {[name: string]: PragmaDefinition<K1, K2, K3, K4>}, K1 extends string, K2 extends string, K3 extends string, K4 extends string>(args: T): T {
return args;
}
@@ -5475,6 +5481,7 @@ namespace ts {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
{ name: "lib", optional: true, captureSpan: true },
{ name: "path", optional: true, captureSpan: true },
{ name: "no-default-lib", optional: true }
],
@@ -5515,13 +5522,15 @@ namespace ts {
*/
/* @internal */
type PragmaArgumentType<T extends PragmaDefinition> =
T extends { args: [PragmaArgumentSpecification<infer TName1>, PragmaArgumentSpecification<infer TName2>, PragmaArgumentSpecification<infer TName3>] }
? PragmaArgTypeOptional<T["args"][0], TName1> & PragmaArgTypeOptional<T["args"][1], TName2> & PragmaArgTypeOptional<T["args"][2], TName3>
: T extends { args: [PragmaArgumentSpecification<infer TName1>, PragmaArgumentSpecification<infer TName2>] }
? PragmaArgTypeOptional<T["args"][0], TName1> & PragmaArgTypeOptional<T["args"][1], TName2>
: T extends { args: [PragmaArgumentSpecification<infer TName>] }
? PragmaArgTypeOptional<T["args"][0], TName>
: object;
T extends { args: [PragmaArgumentSpecification<infer TName1>, PragmaArgumentSpecification<infer TName2>, PragmaArgumentSpecification<infer TName3>, PragmaArgumentSpecification<infer TName4>] }
? PragmaArgTypeOptional<T["args"][0], TName1> & PragmaArgTypeOptional<T["args"][1], TName2> & PragmaArgTypeOptional<T["args"][2], TName3> & PragmaArgTypeOptional<T["args"][2], TName4>
: T extends { args: [PragmaArgumentSpecification<infer TName1>, PragmaArgumentSpecification<infer TName2>, PragmaArgumentSpecification<infer TName3>] }
? PragmaArgTypeOptional<T["args"][0], TName1> & PragmaArgTypeOptional<T["args"][1], TName2> & PragmaArgTypeOptional<T["args"][2], TName3>
: T extends { args: [PragmaArgumentSpecification<infer TName1>, PragmaArgumentSpecification<infer TName2>] }
? PragmaArgTypeOptional<T["args"][0], TName1> & PragmaArgTypeOptional<T["args"][1], TName2>
: T extends { args: [PragmaArgumentSpecification<infer TName>] }
? PragmaArgTypeOptional<T["args"][0], TName>
: object;
// The above fallback to `object` when there's no args to allow `{}` (as intended), but not the number 2, for example
// TODO: Swap to `undefined` for a cleaner API once strictNullChecks is enabled
+2 -1
View File
@@ -576,7 +576,8 @@ namespace Harness.LanguageService {
importedFiles: [],
ambientExternalModules: [],
isLibFile: shimResult.isLibFile,
typeReferenceDirectives: []
typeReferenceDirectives: [],
libReferenceDirectives: []
};
ts.forEach(shimResult.referencedFiles, refFile => {
+3 -3
View File
@@ -60,7 +60,7 @@ namespace ts {
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -262,7 +262,7 @@ namespace ts {
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -281,7 +281,7 @@ namespace ts {
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -268,7 +268,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
@@ -299,7 +299,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
@@ -330,7 +330,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
@@ -361,7 +361,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
@@ -9,6 +9,7 @@ describe("PreProcessFile:", () => {
checkFileReferenceList("Imported files", expectedPreProcess.importedFiles, resultPreProcess.importedFiles);
checkFileReferenceList("Referenced files", expectedPreProcess.referencedFiles, resultPreProcess.referencedFiles);
checkFileReferenceList("Type reference directives", expectedPreProcess.typeReferenceDirectives, resultPreProcess.typeReferenceDirectives);
checkFileReferenceList("Lib reference directives", expectedPreProcess.libReferenceDirectives, resultPreProcess.libReferenceDirectives);
assert.deepEqual(resultPreProcess.ambientExternalModules, expectedPreProcess.ambientExternalModules);
}
@@ -41,6 +42,7 @@ describe("PreProcessFile:", () => {
{ fileName: "refFile3.ts", pos: 94, end: 105 }, { fileName: "..\\refFile4d.ts", pos: 131, end: 146 }],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -54,6 +56,7 @@ describe("PreProcessFile:", () => {
referencedFiles: <ts.FileReference[]>[],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -67,6 +70,7 @@ describe("PreProcessFile:", () => {
referencedFiles: <ts.FileReference[]>[],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -80,6 +84,7 @@ describe("PreProcessFile:", () => {
referencedFiles: <ts.FileReference[]>[],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -92,6 +97,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 },
{ fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }],
ambientExternalModules: undefined,
@@ -106,6 +112,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: <ts.FileReference[]>[],
ambientExternalModules: undefined,
isLibFile: false
@@ -119,6 +126,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -132,6 +140,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [{ fileName: "refFile1.ts", pos: 20, end: 31 }, { fileName: "refFile2.ts", pos: 57, end: 68 }],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -145,6 +154,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [{ fileName: "refFile1.ts", pos: 20, end: 31 }],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -164,6 +174,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 20, end: 22 },
{ fileName: "m2", pos: 51, end: 53 },
@@ -188,6 +199,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 14, end: 16 },
{ fileName: "m2", pos: 36, end: 38 },
@@ -212,6 +224,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [],
ambientExternalModules: ["B"],
isLibFile: false
@@ -225,6 +238,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 26, end: 28 }
],
@@ -244,6 +258,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 39, end: 41 },
{ fileName: "m2", pos: 74, end: 76 },
@@ -264,6 +279,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "mod1", pos: 21, end: 25 },
{ fileName: "mod2", pos: 29, end: 33 },
@@ -282,6 +298,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "mod1", pos: 28, end: 32 },
{ fileName: "mod2", pos: 36, end: 40 },
@@ -303,6 +320,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "../Observable", pos: 28, end: 41 }
],
@@ -323,6 +341,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m", pos: 123, end: 124 },
{ fileName: "../Observable", pos: 28, end: 41 }
@@ -344,6 +363,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m", pos: 123, end: 124 },
{ fileName: "../Observable", pos: 28, end: 41 }
@@ -365,6 +385,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "../Observable", pos: 28, end: 41 }
],
@@ -385,6 +406,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "../Observable", pos: 28, end: 41 }
],
@@ -404,6 +426,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "../Observable", pos: 28, end: 41 }
],
@@ -425,6 +448,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m2", pos: 65, end: 67 },
{ fileName: "augmentation", pos: 102, end: 114 }
@@ -449,6 +473,7 @@ describe("PreProcessFile:", () => {
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [
{ fileName: "m2", pos: 127, end: 129 },
{ fileName: "augmentation", pos: 164, end: 176 }
@@ -475,6 +500,32 @@ describe("PreProcessFile:", () => {
{ pos: 73, end: 75, fileName: "a1" },
{ pos: 152, end: 154, fileName: "a3" }
],
libReferenceDirectives: [],
importedFiles: [],
ambientExternalModules: undefined,
isLibFile: false
});
});
it ("correctly recognizes lib reference directives", () => {
test(`
/// <reference path="a"/>
/// <reference lib="a1"/>
/// <reference path="a2"/>
/// <reference lib="a3"/>
`,
/*readImportFile*/ true,
/*detectJavaScriptImports*/ false,
{
referencedFiles: [
{ pos: 34, end: 35, fileName: "a" },
{ pos: 110, end: 112, fileName: "a2" }
],
typeReferenceDirectives: [
],
libReferenceDirectives: [
{ pos: 71, end: 73, fileName: "a1" },
{ pos: 148, end: 150, fileName: "a3" }
],
importedFiles: [],
ambientExternalModules: undefined,
isLibFile: false
+1 -1
View File
@@ -267,7 +267,7 @@ namespace ts {
const fs = vfs.createFromFileSystem(Harness.IO, /*caseSensitive*/ true, { documents: [new documents.TextDocument("/.src/index.ts", text)] });
const host = new fakes.CompilerHost(fs, opts.compilerOptions);
const program = createProgram(["/.src/index.ts"], opts.compilerOptions!, host);
program.emit(program.getSourceFiles()[1], (p, s, bom) => host.writeFile(p, s, bom), /*cancellationToken*/ undefined, /*onlyDts*/ true, opts.transformers);
program.emit(program.getSourceFile("/.src/index.ts"), (p, s, bom) => host.writeFile(p, s, bom), /*cancellationToken*/ undefined, /*onlyDts*/ true, opts.transformers);
return fs.readFileSync("/.src/index.d.ts").toString();
}
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="lib.dom.d.ts" />
/// <reference lib="dom" />
interface DOMTokenList {
[Symbol.iterator](): IterableIterator<string>;
+10 -10
View File
@@ -1,10 +1,10 @@
/// <reference path="lib.es2015.core.d.ts" />
/// <reference path="lib.es2015.collection.d.ts" />
/// <reference path="lib.es2015.generator.d.ts" />
/// <reference path="lib.es2015.promise.d.ts" />
/// <reference path="lib.es2015.iterable.d.ts" />
/// <reference path="lib.es2015.proxy.d.ts" />
/// <reference path="lib.es2015.reflect.d.ts" />
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
/// <reference path="lib.es5.d.ts" />
/// <reference lib="es5" />
/// <reference lib="es2015.core" />
/// <reference lib="es2015.collection" />
/// <reference lib="es2015.generator" />
/// <reference lib="es2015.promise" />
/// <reference lib="es2015.iterable" />
/// <reference lib="es2015.proxy" />
/// <reference lib="es2015.reflect" />
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.symbol.wellknown" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="es2015" />
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {
/**
+1 -1
View File
@@ -1,4 +1,4 @@
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference lib="es2015.symbol" />
interface SymbolConstructor {
/**
+2 -2
View File
@@ -1,2 +1,2 @@
/// <reference path="lib.es2015.d.ts" />
/// <reference path="lib.es2016.array.include.d.ts" />
/// <reference lib="es2015" />
/// <reference lib="es2016.array.include" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="es2016" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
+6 -6
View File
@@ -1,6 +1,6 @@
/// <reference path="lib.es2016.d.ts" />
/// <reference path="lib.es2017.object.d.ts" />
/// <reference path="lib.es2017.sharedmemory.d.ts" />
/// <reference path="lib.es2017.string.d.ts" />
/// <reference path="lib.es2017.intl.d.ts" />
/// <reference path="lib.es2017.typedarrays.d.ts" />
/// <reference lib="es2016" />
/// <reference lib="es2017.object" />
/// <reference lib="es2017.sharedmemory" />
/// <reference lib="es2017.string" />
/// <reference lib="es2017.intl" />
/// <reference lib="es2017.typedarrays" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="es2017" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
+2 -2
View File
@@ -1,5 +1,5 @@
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.symbol.wellknown" />
interface SharedArrayBuffer {
/**
+4 -4
View File
@@ -1,4 +1,4 @@
/// <reference path="lib.es2017.d.ts" />
/// <reference path="lib.es2018.promise.d.ts" />
/// <reference path="lib.es2018.regexp.d.ts" />
/// <reference path="lib.es2018.intl.d.ts" />
/// <reference lib="es2017" />
/// <reference lib="es2018.promise" />
/// <reference lib="es2018.regexp" />
/// <reference lib="es2018.intl" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="es2018" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
+4
View File
@@ -0,0 +1,4 @@
/// <reference lib="es5" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
+2 -2
View File
@@ -1,5 +1,5 @@
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.iterable.d.ts" />
/// <reference lib="es2015.symbol" />
/// <reference lib="es2015.iterable" />
interface SymbolConstructor {
/**
+4 -4
View File
@@ -1,4 +1,4 @@
/// <reference path="lib.es2018.d.ts" />
/// <reference path="lib.esnext.asynciterable.d.ts" />
/// <reference path="lib.esnext.array.d.ts" />
/// <reference path="lib.esnext.symbol.d.ts" />
/// <reference lib="es2018" />
/// <reference lib="esnext.asynciterable" />
/// <reference lib="esnext.array" />
/// <reference lib="esnext.symbol" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="esnext" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
+1 -52
View File
@@ -11,6 +11,7 @@
"dom.generated",
"dom.iterable",
"webworker.generated",
"webworker.importscripts",
"scripthost",
// By-feature options
"es2015.core",
@@ -47,57 +48,5 @@
"webworker.generated": "lib.webworker.d.ts",
"es5.full": "lib.d.ts",
"es2015.full": "lib.es6.d.ts"
},
"sources": {
"es5.full": [
"es5.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts"
],
"es2015.full": [
"es5.d.ts",
"es2015.core.d.ts",
"es2015.collection.d.ts",
"es2015.generator.d.ts",
"es2015.iterable.d.ts",
"es2015.promise.d.ts",
"es2015.proxy.d.ts",
"es2015.reflect.d.ts",
"es2015.symbol.d.ts",
"es2015.symbol.wellknown.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts",
"dom.iterable.d.ts"
],
"es2016.full": [
"es2016.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts",
"dom.iterable.d.ts"
],
"es2017.full": [
"es2017.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts",
"dom.iterable.d.ts"
],
"es2018.full": [
"es2018.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts",
"dom.iterable.d.ts"
],
"esnext.full": [
"esnext.d.ts",
"dom.generated.d.ts",
"webworker.importscripts.d.ts",
"scripthost.d.ts",
"dom.iterable.d.ts"
]
}
}
+12 -13
View File
@@ -1397,28 +1397,28 @@ declare var URL: {
};
interface URLSearchParams {
/**
* Appends a specified key/value pair as a new search parameter.
/**
* Appends a specified key/value pair as a new search parameter.
*/
append(name: string, value: string): void;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*/
delete(name: string): void;
/**
* Returns the first value associated to the given search parameter.
/**
* Returns the first value associated to the given search parameter.
*/
get(name: string): string | null;
/**
* Returns all the values association with a given search parameter.
/**
* Returns all the values association with a given search parameter.
*/
getAll(name: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
/**
* Returns a Boolean indicating if such a search parameter exists.
*/
has(name: string): boolean;
/**
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
/**
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
}
@@ -1710,7 +1710,6 @@ declare var navigator: WorkerNavigator;
declare function clearImmediate(handle: number): void;
declare function clearInterval(handle: number): void;
declare function clearTimeout(handle: number): void;
declare function importScripts(...urls: string[]): void;
declare function setImmediate(handler: any, ...args: any[]): number;
declare function setInterval(handler: any, timeout?: any, ...args: any[]): number;
declare function setTimeout(handler: any, timeout?: any, ...args: any[]): number;
+10 -1
View File
@@ -107,6 +107,12 @@ namespace ts.GoToDefinition {
return file && { fileName: typeReferenceDirective.fileName, file };
}
const libReferenceDirective = findReferenceInPosition(sourceFile.libReferenceDirectives, position);
if (libReferenceDirective) {
const file = program.getLibFileFromReference(libReferenceDirective);
return file && { fileName: libReferenceDirective.fileName, file };
}
return undefined;
}
@@ -138,7 +144,10 @@ namespace ts.GoToDefinition {
}
// Check if position is on triple slash reference.
const comment = findReferenceInPosition(sourceFile.referencedFiles, position) || findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
const comment = findReferenceInPosition(sourceFile.referencedFiles, position) ||
findReferenceInPosition(sourceFile.typeReferenceDirectives, position) ||
findReferenceInPosition(sourceFile.libReferenceDirectives, position);
if (comment) {
return { definitions, textSpan: createTextSpanFromRange(comment) };
}
+3 -2
View File
@@ -6,6 +6,7 @@ namespace ts {
checkJsDirective: undefined,
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
amdDependencies: [],
hasNoDefaultLib: undefined,
moduleName: undefined
@@ -336,7 +337,7 @@ namespace ts {
importedFiles.push(decl.ref);
}
}
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: undefined };
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: undefined };
}
else {
// for global scripts ambient modules still can have augmentations - look for ambient modules with depth > 0
@@ -354,7 +355,7 @@ namespace ts {
}
}
}
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames };
return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames };
}
}
}
+1
View File
@@ -551,6 +551,7 @@ namespace ts {
public moduleName: string;
public referencedFiles: FileReference[];
public typeReferenceDirectives: FileReference[];
public libReferenceDirectives: FileReference[];
public syntacticDiagnostics: DiagnosticWithLocation[];
public parseDiagnostics: DiagnosticWithLocation[];
+2 -1
View File
@@ -1104,7 +1104,8 @@ namespace ts {
importedFiles: this.convertFileReferences(result.importedFiles),
ambientExternalModules: result.ambientExternalModules,
isLibFile: result.isLibFile,
typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives)
typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives),
libReferenceDirectives: this.convertFileReferences(result.libReferenceDirectives)
};
});
}
+2
View File
@@ -151,9 +151,11 @@ namespace ts {
return new StringScriptSnapshot(text);
}
}
export interface PreProcessedFileInfo {
referencedFiles: FileReference[];
typeReferenceDirectives: FileReference[];
libReferenceDirectives: FileReference[];
importedFiles: FileReference[];
ambientExternalModules?: string[];
isLibFile: boolean;
+2 -2
View File
@@ -25,11 +25,11 @@ class Board {
>allShipsSunk : Symbol(Board.allShipsSunk, Decl(2dArrays.ts, 9, 18))
return this.ships.every(function (val) { return val.isSunk; });
>this.ships.every : Symbol(Array.every, Decl(lib.d.ts, --, --))
>this.ships.every : Symbol(Array.every, Decl(lib.es5.d.ts, --, --))
>this.ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
>this : Symbol(Board, Decl(2dArrays.ts, 5, 1))
>ships : Symbol(Board.ships, Decl(2dArrays.ts, 7, 13))
>every : Symbol(Array.every, Decl(lib.d.ts, --, --))
>every : Symbol(Array.every, Decl(lib.es5.d.ts, --, --))
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
>val.isSunk : Symbol(Ship.isSunk, Decl(2dArrays.ts, 3, 12))
>val : Symbol(val, Decl(2dArrays.ts, 12, 42))
+3 -3
View File
@@ -3,8 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
console.log(v);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
}
@@ -6,8 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of22.ts, 1, 7))
console.log(x);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8))
}
@@ -6,8 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of23.ts, 1, 7))
console.log(x);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of23.ts, 0, 8))
}
@@ -3,8 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))
console.log(v);
>console.log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console : Symbol(console, Decl(lib.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.d.ts, --, --))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))
}
@@ -1,8 +1,8 @@
=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck13.ts ===
const strSet: Set<string> = new Set()
>strSet : Symbol(strSet, Decl(ES5For-ofTypeCheck13.ts, 0, 5))
>Set : Symbol(Set, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --))
>Set : Symbol(Set, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --))
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
strSet.add('Hello')
>strSet.add : Symbol(Set.add, Decl(lib.es2015.collection.d.ts, --, --))
@@ -1,7 +1,7 @@
=== tests/cases/conformance/statements/for-ofStatements/ES5For-ofTypeCheck14.ts ===
var union: string | Set<number>
>union : Symbol(union, Decl(ES5For-ofTypeCheck14.ts, 0, 3))
>Set : Symbol(Set, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --))
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
for (const e of union) { }
>e : Symbol(e, Decl(ES5For-ofTypeCheck14.ts, 1, 10))
@@ -6,7 +6,7 @@ interface SymbolConstructor {
>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29))
}
var Symbol: SymbolConstructor;
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>SymbolConstructor : Symbol(SymbolConstructor, Decl(ES5SymbolProperty1.ts, 0, 0))
var obj = {
@@ -15,13 +15,13 @@ var obj = {
[Symbol.foo]: 0
>[Symbol.foo] : Symbol([Symbol.foo], Decl(ES5SymbolProperty1.ts, 5, 11))
>Symbol.foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29))
}
obj[Symbol.foo];
>obj : Symbol(obj, Decl(ES5SymbolProperty1.ts, 5, 3))
>Symbol.foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty1.ts, 3, 3))
>foo : Symbol(SymbolConstructor.foo, Decl(ES5SymbolProperty1.ts, 0, 29))
@@ -1,16 +1,16 @@
=== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts ===
var Symbol: any;
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
class C {
>C : Symbol(C, Decl(ES5SymbolProperty3.ts, 0, 16))
[Symbol.iterator]() { }
>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty3.ts, 2, 9))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
}
(new C)[Symbol.iterator]
>C : Symbol(C, Decl(ES5SymbolProperty3.ts, 0, 16))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty3.ts, 0, 3))
@@ -1,6 +1,6 @@
=== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts ===
var Symbol: { iterator: string };
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13))
class C {
@@ -9,13 +9,13 @@ class C {
[Symbol.iterator]() { }
>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty4.ts, 2, 9))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13))
}
(new C)[Symbol.iterator]
>C : Symbol(C, Decl(ES5SymbolProperty4.ts, 0, 33))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty4.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty4.ts, 0, 13))
@@ -1,6 +1,6 @@
=== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts ===
var Symbol: { iterator: symbol };
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 13))
class C {
@@ -9,13 +9,13 @@ class C {
[Symbol.iterator]() { }
>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty5.ts, 2, 9))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 13))
}
(new C)[Symbol.iterator](0) // Should error
>C : Symbol(C, Decl(ES5SymbolProperty5.ts, 0, 33))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty5.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty5.ts, 0, 13))
@@ -1,6 +1,6 @@
=== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts ===
var Symbol: { iterator: any };
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13))
class C {
@@ -9,13 +9,13 @@ class C {
[Symbol.iterator]() { }
>[Symbol.iterator] : Symbol(C[Symbol.iterator], Decl(ES5SymbolProperty7.ts, 2, 9))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13))
}
(new C)[Symbol.iterator]
>C : Symbol(C, Decl(ES5SymbolProperty7.ts, 0, 30))
>Symbol.iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13))
>Symbol : Symbol(Symbol, Decl(lib.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(ES5SymbolProperty7.ts, 0, 3))
>iterator : Symbol(iterator, Decl(ES5SymbolProperty7.ts, 0, 13))
@@ -3,7 +3,7 @@ var s: symbol;
>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3))
s.toString();
>s.toString : Symbol(Symbol.toString, Decl(lib.d.ts, --, --))
>s.toString : Symbol(Symbol.toString, Decl(lib.es5.d.ts, --, --))
>s : Symbol(s, Decl(ES5SymbolType1.ts, 0, 3))
>toString : Symbol(Symbol.toString, Decl(lib.d.ts, --, --))
>toString : Symbol(Symbol.toString, Decl(lib.es5.d.ts, --, --))
@@ -11,11 +11,11 @@ module A {
export var beez: Array<B>;
>beez : Symbol(beez, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 5, 14))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10))
export var beez2 = new Array<B>();
>beez2 : Symbol(beez2, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 6, 14))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>B : Symbol(B, Decl(ExportVariableOfGenericTypeWithInaccessibleTypeAsTypeArgument.ts, 0, 10))
}
@@ -14,12 +14,12 @@ function saySize(message: Message | Message[]) {
if (message instanceof Array) {
>message : Symbol(message, Decl(TypeGuardWithArrayUnion.ts, 4, 17))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
return message.length; // Should have type Message[] here
>message.length : Symbol(Array.length, Decl(lib.d.ts, --, --))
>message.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>message : Symbol(message, Decl(TypeGuardWithArrayUnion.ts, 4, 17))
>length : Symbol(Array.length, Decl(lib.d.ts, --, --))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
}
}
@@ -11,16 +11,16 @@ abstract class AbstractClass {
>this.method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
>this : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
>method : Symbol(AbstractClass.method, Decl(abstractPropertyInConstructor.ts, 20, 37))
>parseInt : Symbol(parseInt, Decl(lib.d.ts, --, --))
>parseInt : Symbol(parseInt, Decl(lib.es5.d.ts, --, --))
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 1, 16))
let val = this.prop.toLowerCase();
>val : Symbol(val, Decl(abstractPropertyInConstructor.ts, 3, 11))
>this.prop.toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>this.prop.toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
>this.prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>this : Symbol(AbstractClass, Decl(abstractPropertyInConstructor.ts, 0, 0))
>prop : Symbol(AbstractClass.prop, Decl(abstractPropertyInConstructor.ts, 17, 5))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.d.ts, --, --))
>toLowerCase : Symbol(String.toLowerCase, Decl(lib.es5.d.ts, --, --))
if (!str) {
>str : Symbol(str, Decl(abstractPropertyInConstructor.ts, 1, 16))
@@ -35,7 +35,7 @@ var d: string;
var e: Object;
>e : Symbol(e, Decl(additionOperatorWithAnyAndEveryType.ts, 12, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// any as left operand, result is type Any except plusing string
var r1 = a + a;
@@ -3,7 +3,7 @@
function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k: K) {
>sum : Symbol(sum, Decl(additionOperatorWithConstrainedTypeParameter.ts, 0, 0))
>T : Symbol(T, Decl(additionOperatorWithConstrainedTypeParameter.ts, 1, 13))
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
>K : Symbol(K, Decl(additionOperatorWithConstrainedTypeParameter.ts, 1, 41))
>K : Symbol(K, Decl(additionOperatorWithConstrainedTypeParameter.ts, 1, 41))
>n : Symbol(n, Decl(additionOperatorWithConstrainedTypeParameter.ts, 1, 60))
@@ -26,7 +26,7 @@ function sum<T extends Record<K, number>, K extends string>(n: number, v: T, k:
function realSum<T extends Record<K, number>, K extends string>(n: number, vs: T[], k: K) {
>realSum : Symbol(realSum, Decl(additionOperatorWithConstrainedTypeParameter.ts, 4, 1))
>T : Symbol(T, Decl(additionOperatorWithConstrainedTypeParameter.ts, 5, 17))
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
>K : Symbol(K, Decl(additionOperatorWithConstrainedTypeParameter.ts, 5, 45))
>K : Symbol(K, Decl(additionOperatorWithConstrainedTypeParameter.ts, 5, 45))
>n : Symbol(n, Decl(additionOperatorWithConstrainedTypeParameter.ts, 5, 64))
@@ -29,11 +29,11 @@ var b: number;
var c: Object;
>c : Symbol(c, Decl(additionOperatorWithInvalidOperands.ts, 10, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var d: Number;
>d : Symbol(d, Decl(additionOperatorWithInvalidOperands.ts, 11, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// boolean + every type except any and string
var r1 = a + a;
@@ -10,14 +10,14 @@ var a: boolean;
var b: Object;
>b : Symbol(b, Decl(additionOperatorWithNullValueAndInvalidOperator.ts, 5, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var c: void;
>c : Symbol(c, Decl(additionOperatorWithNullValueAndInvalidOperator.ts, 6, 3))
var d: Number;
>d : Symbol(d, Decl(additionOperatorWithNullValueAndInvalidOperator.ts, 7, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// null + boolean/Object
var r1 = null + a;
@@ -19,7 +19,7 @@ var d: string;
var e: Object;
>e : Symbol(e, Decl(additionOperatorWithStringAndEveryType.ts, 6, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var f: void;
>f : Symbol(f, Decl(additionOperatorWithStringAndEveryType.ts, 7, 3))
@@ -28,7 +28,7 @@ function foo<T, U>(t: T, u: U) {
var e: Object;
>e : Symbol(e, Decl(additionOperatorWithTypeParameter.ts, 8, 7))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var g: E;
>g : Symbol(g, Decl(additionOperatorWithTypeParameter.ts, 9, 7))
@@ -10,14 +10,14 @@ var a: boolean;
var b: Object;
>b : Symbol(b, Decl(additionOperatorWithUndefinedValueAndInvalidOperands.ts, 5, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var c: void;
>c : Symbol(c, Decl(additionOperatorWithUndefinedValueAndInvalidOperands.ts, 6, 3))
var d: Number;
>d : Symbol(d, Decl(additionOperatorWithUndefinedValueAndInvalidOperands.ts, 7, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// undefined + boolean/Object
var r1 = undefined + a;
@@ -5,7 +5,7 @@ interface ComponentOptions<V> {
watch: Record<string, WatchHandler<any>>;
>watch : Symbol(ComponentOptions.watch, Decl(func.ts, 0, 31))
>Record : Symbol(Record, Decl(lib.d.ts, --, --))
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
>WatchHandler : Symbol(WatchHandler, Decl(func.ts, 2, 1))
}
type WatchHandler<T> = (val: T) => void;
@@ -40,7 +40,7 @@ export var a = vextend({
>val : Symbol(val, Decl(app.js, 4, 10))
this.data2 = 1;
>this : Symbol(__type, Decl(lib.d.ts, --, --))
>this : Symbol(__type, Decl(lib.es5.d.ts, --, --))
>data2 : Symbol(data2, Decl(app.js, 4, 16), Decl(app.js, 6, 6))
},
@@ -62,13 +62,13 @@ const c12 = 123 + 456;
const c13 = Math.random() > 0.5 ? "abc" : "def";
>c13 : Symbol(c13, Decl(ambientConstLiterals.ts, 18, 5))
>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.d.ts, --, --))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
const c14 = Math.random() > 0.5 ? 123 : 456;
>c14 : Symbol(c14, Decl(ambientConstLiterals.ts, 19, 5))
>Math.random : Symbol(Math.random, Decl(lib.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.d.ts, --, --))
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
@@ -12,6 +12,6 @@
x = 'foo'.length
>x : Symbol(E2.x, Decl(ambientEnum1.ts, 5, 21))
>'foo'.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
>'foo'.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
}
@@ -53,8 +53,8 @@ declare enum E2 {
x = 'foo'.length
>x : Symbol(E2.x, Decl(ambientErrors.ts, 27, 17))
>'foo'.length : Symbol(String.length, Decl(lib.d.ts, --, --))
>length : Symbol(String.length, Decl(lib.d.ts, --, --))
>'foo'.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
}
// Ambient module with initializers for values, bodies for functions / classes
@@ -56,8 +56,8 @@ var r3 = foo3(a); // any
declare function foo5(x: Date): Date;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 21, 22))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
declare function foo5(x: any): any;
>foo5 : Symbol(foo5, Decl(anyAssignabilityInInheritance.ts, 19, 17), Decl(anyAssignabilityInInheritance.ts, 21, 37))
@@ -71,8 +71,8 @@ var r3 = foo3(a); // any
declare function foo6(x: RegExp): RegExp;
>foo6 : Symbol(foo6, Decl(anyAssignabilityInInheritance.ts, 23, 17), Decl(anyAssignabilityInInheritance.ts, 25, 41))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 25, 22))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
declare function foo6(x: any): any;
>foo6 : Symbol(foo6, Decl(anyAssignabilityInInheritance.ts, 23, 17), Decl(anyAssignabilityInInheritance.ts, 25, 41))
@@ -277,8 +277,8 @@ var r3 = foo3(a); // any
declare function foo17(x: Object): Object;
>foo17 : Symbol(foo17, Decl(anyAssignabilityInInheritance.ts, 79, 17), Decl(anyAssignabilityInInheritance.ts, 81, 42))
>x : Symbol(x, Decl(anyAssignabilityInInheritance.ts, 81, 23))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
declare function foo17(x: any): any;
>foo17 : Symbol(foo17, Decl(anyAssignabilityInInheritance.ts, 79, 17), Decl(anyAssignabilityInInheritance.ts, 81, 42))
@@ -44,7 +44,7 @@ var d: boolean = a;
var e: Date = a;
>e : Symbol(e, Decl(anyAssignableToEveryType.ts, 17, 3))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var f: any = a;
@@ -57,7 +57,7 @@ var g: void = a;
var h: Object = a;
>h : Symbol(h, Decl(anyAssignableToEveryType.ts, 20, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var i: {} = a;
@@ -70,7 +70,7 @@ var j: () => {} = a;
var k: Function = a;
>k : Symbol(k, Decl(anyAssignableToEveryType.ts, 23, 3))
>Function : Symbol(Function, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var l: (x: number) => string = a;
@@ -109,12 +109,12 @@ var o: <T>(x: T) => T = a;
var p: Number = a;
>p : Symbol(p, Decl(anyAssignableToEveryType.ts, 31, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
var q: String = a;
>q : Symbol(q, Decl(anyAssignableToEveryType.ts, 32, 3))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(anyAssignableToEveryType.ts, 0, 3))
function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
@@ -122,7 +122,7 @@ function foo<T, U /*extends T*/, V extends Date>(x: T, y: U, z: V) {
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>U : Symbol(U, Decl(anyAssignableToEveryType.ts, 34, 15))
>V : Symbol(V, Decl(anyAssignableToEveryType.ts, 34, 32))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
>x : Symbol(x, Decl(anyAssignableToEveryType.ts, 34, 49))
>T : Symbol(T, Decl(anyAssignableToEveryType.ts, 34, 13))
>y : Symbol(y, Decl(anyAssignableToEveryType.ts, 34, 54))
@@ -50,7 +50,7 @@ interface I5 {
[x: string]: Date;
>x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 27, 5))
>Date : Symbol(Date, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --))
foo: any;
>foo : Symbol(I5.foo, Decl(anyAssignableToEveryType2.ts, 27, 22))
@@ -62,7 +62,7 @@ interface I6 {
[x: string]: RegExp;
>x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 33, 5))
>RegExp : Symbol(RegExp, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>RegExp : Symbol(RegExp, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
foo: any;
>foo : Symbol(I6.foo, Decl(anyAssignableToEveryType2.ts, 33, 24))
@@ -255,7 +255,7 @@ interface I19 {
[x: string]: Object;
>x : Symbol(x, Decl(anyAssignableToEveryType2.ts, 120, 5))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
foo: any;
>foo : Symbol(I19.foo, Decl(anyAssignableToEveryType2.ts, 120, 24))
@@ -3,9 +3,9 @@ var paired: any[];
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
paired.reduce(function (a1, a2) {
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired.reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a1 : Symbol(a1, Decl(anyInferenceAnonymousFunctions.ts, 2, 24))
>a2 : Symbol(a2, Decl(anyInferenceAnonymousFunctions.ts, 2, 27))
@@ -15,9 +15,9 @@ paired.reduce(function (a1, a2) {
} , []);
paired.reduce((b1, b2) => {
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired.reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>b1 : Symbol(b1, Decl(anyInferenceAnonymousFunctions.ts, 8, 15))
>b2 : Symbol(b2, Decl(anyInferenceAnonymousFunctions.ts, 8, 18))
@@ -27,24 +27,24 @@ paired.reduce((b1, b2) => {
} , []);
paired.reduce((b3, b4) => b3.concat({}), []);
>paired.reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>paired.reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>reduce : Symbol(Array.reduce, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>reduce : Symbol(Array.reduce, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
>b4 : Symbol(b4, Decl(anyInferenceAnonymousFunctions.ts, 13, 18))
>b3 : Symbol(b3, Decl(anyInferenceAnonymousFunctions.ts, 13, 15))
paired.map((c1) => c1.count);
>paired.map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>paired.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>c1 : Symbol(c1, Decl(anyInferenceAnonymousFunctions.ts, 15, 12))
>c1 : Symbol(c1, Decl(anyInferenceAnonymousFunctions.ts, 15, 12))
paired.map(function (c2) { return c2.count; });
>paired.map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>paired.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>paired : Symbol(paired, Decl(anyInferenceAnonymousFunctions.ts, 0, 3))
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>c2 : Symbol(c2, Decl(anyInferenceAnonymousFunctions.ts, 16, 21))
>c2 : Symbol(c2, Decl(anyInferenceAnonymousFunctions.ts, 16, 21))
+3 -1
View File
@@ -1648,6 +1648,7 @@ declare namespace ts {
moduleName?: string;
referencedFiles: ReadonlyArray<FileReference>;
typeReferenceDirectives: ReadonlyArray<FileReference>;
libReferenceDirectives: ReadonlyArray<FileReference>;
languageVariant: LanguageVariant;
isDeclarationFile: boolean;
/**
@@ -3801,7 +3802,7 @@ declare namespace ts {
function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean): SourceFile;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean, libReferences?: SourceFile["libReferenceDirectives"]): SourceFile;
/**
* Creates a shallow, memberwise clone of a node for mutation.
*/
@@ -4467,6 +4468,7 @@ declare namespace ts {
interface PreProcessedFileInfo {
referencedFiles: FileReference[];
typeReferenceDirectives: FileReference[];
libReferenceDirectives: FileReference[];
importedFiles: FileReference[];
ambientExternalModules?: string[];
isLibFile: boolean;
+3 -1
View File
@@ -1648,6 +1648,7 @@ declare namespace ts {
moduleName?: string;
referencedFiles: ReadonlyArray<FileReference>;
typeReferenceDirectives: ReadonlyArray<FileReference>;
libReferenceDirectives: ReadonlyArray<FileReference>;
languageVariant: LanguageVariant;
isDeclarationFile: boolean;
/**
@@ -3801,7 +3802,7 @@ declare namespace ts {
function updateSpreadAssignment(node: SpreadAssignment, expression: Expression): SpreadAssignment;
function createEnumMember(name: string | PropertyName, initializer?: Expression): EnumMember;
function updateEnumMember(node: EnumMember, name: PropertyName, initializer: Expression | undefined): EnumMember;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean): SourceFile;
function updateSourceFileNode(node: SourceFile, statements: ReadonlyArray<Statement>, isDeclarationFile?: boolean, referencedFiles?: SourceFile["referencedFiles"], typeReferences?: SourceFile["typeReferenceDirectives"], hasNoDefaultLib?: boolean, libReferences?: SourceFile["libReferenceDirectives"]): SourceFile;
/**
* Creates a shallow, memberwise clone of a node for mutation.
*/
@@ -4467,6 +4468,7 @@ declare namespace ts {
interface PreProcessedFileInfo {
referencedFiles: FileReference[];
typeReferenceDirectives: FileReference[];
libReferenceDirectives: FileReference[];
importedFiles: FileReference[];
ambientExternalModules?: string[];
isLibFile: boolean;
@@ -5,7 +5,7 @@
class Base<U extends String> {
>Base : Symbol(Base, Decl(apparentTypeSubtyping.ts, 0, 0))
>U : Symbol(U, Decl(apparentTypeSubtyping.ts, 3, 11))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
x: U;
>x : Symbol(Base.x, Decl(apparentTypeSubtyping.ts, 3, 30))
@@ -20,7 +20,7 @@ class Derived<U> extends Base<string> { // error
x: String;
>x : Symbol(Derived.x, Decl(apparentTypeSubtyping.ts, 8, 39))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
class Base2 {
@@ -28,18 +28,18 @@ class Base2 {
x: String;
>x : Symbol(Base2.x, Decl(apparentTypeSubtyping.ts, 12, 13))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
static s: String;
>s : Symbol(Base2.s, Decl(apparentTypeSubtyping.ts, 13, 14))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
// is U extends String (S) a subtype of String (T)? Apparent type of U is String so it succeeds
class Derived2<U extends String> extends Base2 { // error because of the prototype's not matching, not because of the instance side
>Derived2 : Symbol(Derived2, Decl(apparentTypeSubtyping.ts, 15, 1))
>U : Symbol(U, Decl(apparentTypeSubtyping.ts, 18, 15))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Base2 : Symbol(Base2, Decl(apparentTypeSubtyping.ts, 10, 1))
x: U;
@@ -13,7 +13,7 @@ class Base {
class Derived<U extends String> extends Base { // error
>Derived : Symbol(Derived, Decl(apparentTypeSupertype.ts, 5, 1))
>U : Symbol(U, Decl(apparentTypeSupertype.ts, 8, 14))
>String : Symbol(String, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Base : Symbol(Base, Decl(apparentTypeSupertype.ts, 0, 0))
x: U;
@@ -11,9 +11,9 @@ class C {
for (var i = 0; i < arguments.length; i++) {
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --))
>arguments : Symbol(arguments)
>length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --))
>i : Symbol(i, Decl(argsInScope.ts, 2, 15))
// WScript.Echo("param: " + arguments[i]);
@@ -5,7 +5,7 @@ type MyType = {
arguments: Array<string>
>arguments : Symbol(arguments, Decl(argumentsAsPropertyName.ts, 1, 15))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
declare function use(s: any);
@@ -34,8 +34,8 @@ function myFunction(myType: MyType) {
>x : Symbol(x, Decl(argumentsAsPropertyName.ts, 11, 13))
[1, 2, 3].forEach(function(j) { use(x); })
>[1, 2, 3].forEach : Symbol(Array.forEach, Decl(lib.d.ts, --, --))
>forEach : Symbol(Array.forEach, Decl(lib.d.ts, --, --))
>[1, 2, 3].forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>forEach : Symbol(Array.forEach, Decl(lib.es5.d.ts, --, --))
>j : Symbol(j, Decl(argumentsAsPropertyName.ts, 12, 35))
>use : Symbol(use, Decl(argumentsAsPropertyName.ts, 3, 1))
>x : Symbol(x, Decl(argumentsAsPropertyName.ts, 11, 13))
@@ -13,9 +13,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>arguments : Symbol(arguments)
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator01_ES5.ts, 1, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES5.ts, 2, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES5.ts, 2, 12))
}
@@ -13,9 +13,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>arguments : Symbol(arguments)
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator01_ES6.ts, 1, 7))
>push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 2, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator01_ES6.ts, 2, 12))
}
@@ -17,9 +17,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES5.ts, 1, 7))
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator02_ES5.ts, 3, 7))
>push : Symbol(Array.push, Decl(lib.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES5.ts, 4, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES5.ts, 4, 12))
}
@@ -8,9 +8,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
let blah = arguments[Symbol.iterator];
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 1, 7))
>arguments : Symbol(arguments)
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es6.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --), Decl(lib.es6.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es6.d.ts, --, --))
>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.es2015.iterable.d.ts, --, --))
let result = [];
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 3, 7))
@@ -20,9 +20,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe
>blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 1, 7))
result.push(arg + arg);
>result.push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>result.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 3, 7))
>push : Symbol(Array.push, Decl(lib.es6.d.ts, --, --))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 4, 12))
>arg : Symbol(arg, Decl(argumentsObjectIterator02_ES6.ts, 4, 12))
}
@@ -10,9 +10,9 @@ class A {
return {
selectedValue: arguments.length
>selectedValue : Symbol(selectedValue, Decl(argumentsUsedInObjectLiteralProperty.ts, 2, 16))
>arguments.length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>arguments.length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --))
>arguments : Symbol(arguments)
>length : Symbol(IArguments.length, Decl(lib.d.ts, --, --))
>length : Symbol(IArguments.length, Decl(lib.es5.d.ts, --, --))
};
}
@@ -1,11 +1,11 @@
=== tests/cases/compiler/arithmeticOnInvalidTypes.ts ===
var x: Number;
>x : Symbol(x, Decl(arithmeticOnInvalidTypes.ts, 0, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var y: Number;
>y : Symbol(y, Decl(arithmeticOnInvalidTypes.ts, 1, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var z = x + y;
>z : Symbol(z, Decl(arithmeticOnInvalidTypes.ts, 2, 3))
@@ -25,7 +25,7 @@ var e: { a: number };
var f: Number;
>f : Symbol(f, Decl(arithmeticOperatorWithInvalidOperands.ts, 9, 3))
>Number : Symbol(Number, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// All of the below should be an error unless otherwise noted
// operator *
@@ -10,7 +10,7 @@ var b: string;
var c: Object;
>c : Symbol(c, Decl(arithmeticOperatorWithNullValueAndInvalidOperands.ts, 5, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// operator *
var r1a1 = null * a;
@@ -10,7 +10,7 @@ var b: string;
var c: Object;
>c : Symbol(c, Decl(arithmeticOperatorWithUndefinedValueAndInvalidOperands.ts, 5, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// operator *
var r1a1 = undefined * a;
@@ -1,7 +1,7 @@
=== tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts ===
interface StrNum extends Array<string|number> {
>StrNum : Symbol(StrNum, Decl(arityAndOrderCompatibility01.ts, 0, 0))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
0: string;
>0 : Symbol(StrNum[0], Decl(arityAndOrderCompatibility01.ts, 0, 47))
@@ -81,9 +81,9 @@ module Test {
>tokens : Symbol(ILineTokens.tokens, Decl(arrayAssignmentTest5.ts, 9, 27))
if (tokens.length === 0) {
>tokens.length : Symbol(Array.length, Decl(lib.d.ts, --, --))
>tokens.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>tokens : Symbol(tokens, Decl(arrayAssignmentTest5.ts, 22, 15))
>length : Symbol(Array.length, Decl(lib.d.ts, --, --))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
return this.onEnter(line, tokens, offset); // <== this should produce an error since onEnter can not be called with (string, IStateToken[], offset)
>this.onEnter : Symbol(Bug.onEnter, Decl(arrayAssignmentTest5.ts, 19, 39))
@@ -1,12 +1,12 @@
=== tests/cases/compiler/arrayAugment.ts ===
interface Array<T> {
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 0))
>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(arrayAugment.ts, 0, 0))
>T : Symbol(T, Decl(lib.es5.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
split: (parts: number) => T[][];
>split : Symbol(Array.split, Decl(arrayAugment.ts, 0, 20))
>parts : Symbol(parts, Decl(arrayAugment.ts, 1, 12))
>T : Symbol(T, Decl(lib.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
>T : Symbol(T, Decl(lib.es5.d.ts, --, --), Decl(arrayAugment.ts, 0, 16))
}
var x = [''];
@@ -1,17 +1,17 @@
=== tests/cases/compiler/arrayBufferIsViewNarrowsType.ts ===
var obj: Object;
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
if (ArrayBuffer.isView(obj)) {
>ArrayBuffer.isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.d.ts, --, --))
>ArrayBuffer.isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.es5.d.ts, --, --))
>ArrayBuffer : Symbol(ArrayBuffer, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>isView : Symbol(ArrayBufferConstructor.isView, Decl(lib.es5.d.ts, --, --))
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
// isView should be a guard that narrows type to ArrayBufferView.
var ab: ArrayBufferView = obj;
>ab : Symbol(ab, Decl(arrayBufferIsViewNarrowsType.ts, 3, 7))
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.d.ts, --, --))
>ArrayBufferView : Symbol(ArrayBufferView, Decl(lib.es5.d.ts, --, --))
>obj : Symbol(obj, Decl(arrayBufferIsViewNarrowsType.ts, 0, 3))
}
@@ -3,21 +3,21 @@ var a: string[] = [];
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
a.concat("hello", 'world');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
a.concat('Hello');
>a.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var b = new Array<string>();
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
b.concat('hello');
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
@@ -15,18 +15,18 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1
>T1 : Symbol(T1, Decl(arrayConcat3.ts, 2, 34))
>T : Symbol(T, Decl(arrayConcat3.ts, 2, 17))
>a : Symbol(a, Decl(arrayConcat3.ts, 2, 49))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Fn : Symbol(Fn, Decl(arrayConcat3.ts, 0, 0))
>T : Symbol(T, Decl(arrayConcat3.ts, 2, 17))
>b : Symbol(b, Decl(arrayConcat3.ts, 2, 65))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>Fn : Symbol(Fn, Decl(arrayConcat3.ts, 0, 0))
>T1 : Symbol(T1, Decl(arrayConcat3.ts, 2, 34))
b.concat(a);
>b.concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcat3.ts, 2, 65))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcat3.ts, 2, 49))
}
@@ -1,14 +1,14 @@
=== tests/cases/compiler/arrayConcatMap.ts ===
var x = [].concat([{ a: 1 }], [{ a: 2 }])
>x : Symbol(x, Decl(arrayConcatMap.ts, 0, 3))
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>[].concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 20))
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 32))
.map(b => b.a);
>map : Symbol(Array.map, Decl(lib.d.ts, --, --))
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>b : Symbol(b, Decl(arrayConcatMap.ts, 1, 15))
>b : Symbol(b, Decl(arrayConcatMap.ts, 1, 15))
@@ -4,28 +4,28 @@ var x: string[];
x = new Array(1);
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
x = new Array('hi', 'bye');
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
x = new Array<string>('hi', 'bye');
>x : Symbol(x, Decl(arrayConstructors1.ts, 0, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var y: number[];
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
y = new Array(1);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
y = new Array(1,2);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
y = new Array<number>(1, 2);
>y : Symbol(y, Decl(arrayConstructors1.ts, 5, 3))
>Array : Symbol(Array, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
@@ -14,9 +14,9 @@ var foo = [
]
foo.filter(x => x.name); //should accepted all possible types not only boolean!
>foo.filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>foo.filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>foo : Symbol(foo, Decl(arrayFilter.ts, 0, 3))
>filter : Symbol(Array.filter, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>filter : Symbol(Array.filter, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(arrayFilter.ts, 6, 11))
>x.name : Symbol(name, Decl(arrayFilter.ts, 1, 5))
>x : Symbol(x, Decl(arrayFilter.ts, 6, 11))
+1 -1
View File
@@ -22,7 +22,7 @@ const foundNumber: number | undefined = arrayOfStringsNumbersAndBooleans.find(is
const readonlyArrayOfStringsNumbersAndBooleans = arrayOfStringsNumbersAndBooleans as ReadonlyArray<string | number | boolean>;
>readonlyArrayOfStringsNumbersAndBooleans : Symbol(readonlyArrayOfStringsNumbersAndBooleans, Decl(arrayFind.ts, 8, 5))
>arrayOfStringsNumbersAndBooleans : Symbol(arrayOfStringsNumbersAndBooleans, Decl(arrayFind.ts, 5, 5))
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>ReadonlyArray : Symbol(ReadonlyArray, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
const readonlyFoundNumber: number | undefined = readonlyArrayOfStringsNumbersAndBooleans.find(isNumber);
>readonlyFoundNumber : Symbol(readonlyFoundNumber, Decl(arrayFind.ts, 9, 5))
@@ -1,7 +1,7 @@
tests/cases/compiler/arrayFrom.ts(19,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'.
tests/cases/compiler/arrayFrom.ts(20,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'.
Type 'A' is not assignable to type 'B'.
Property 'b' is missing in type 'A'.
tests/cases/compiler/arrayFrom.ts(22,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'.
tests/cases/compiler/arrayFrom.ts(23,7): error TS2322: Type 'A[]' is not assignable to type 'B[]'.
==== tests/cases/compiler/arrayFrom.ts (2 errors) ====
@@ -20,6 +20,7 @@ tests/cases/compiler/arrayFrom.ts(22,7): error TS2322: Type 'A[]' is not assigna
const inputB: B[] = [];
const inputALike: ArrayLike<A> = { length: 0 };
const inputARand = getEither(inputA, inputALike);
const inputASet = new Set<A>();
const result1: A[] = Array.from(inputA);
const result2: A[] = Array.from(inputA.values());
@@ -36,6 +37,8 @@ tests/cases/compiler/arrayFrom.ts(22,7): error TS2322: Type 'A[]' is not assigna
const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a }));
const result8: A[] = Array.from(inputARand);
const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
const result10: A[] = Array.from(new Set<A>());
const result11: B[] = Array.from(inputASet, ({ a }): B => ({ b: a }));
// if this is written inline, the compiler seems to infer
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
+9
View File
@@ -14,6 +14,7 @@ const inputA: A[] = [];
const inputB: B[] = [];
const inputALike: ArrayLike<A> = { length: 0 };
const inputARand = getEither(inputA, inputALike);
const inputASet = new Set<A>();
const result1: A[] = Array.from(inputA);
const result2: A[] = Array.from(inputA.values());
@@ -24,6 +25,8 @@ const result6: B[] = Array.from(inputALike); // expect error
const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a }));
const result8: A[] = Array.from(inputARand);
const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
const result10: A[] = Array.from(new Set<A>());
const result11: B[] = Array.from(inputASet, ({ a }): B => ({ b: a }));
// if this is written inline, the compiler seems to infer
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
@@ -40,6 +43,7 @@ var inputA = [];
var inputB = [];
var inputALike = { length: 0 };
var inputARand = getEither(inputA, inputALike);
var inputASet = new Set();
var result1 = Array.from(inputA);
var result2 = Array.from(inputA.values());
var result3 = Array.from(inputA.values()); // expect error
@@ -58,6 +62,11 @@ var result9 = Array.from(inputARand, function (_a) {
var a = _a.a;
return ({ b: a });
});
var result10 = Array.from(new Set());
var result11 = Array.from(inputASet, function (_a) {
var a = _a.a;
return ({ b: a });
});
// if this is written inline, the compiler seems to infer
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
// even when the type is written as : Iterable<T>|ArrayLike<T>
+82 -56
View File
@@ -32,116 +32,142 @@ const inputALike: ArrayLike<A> = { length: 0 };
const inputARand = getEither(inputA, inputALike);
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
>getEither : Symbol(getEither, Decl(arrayFrom.ts, 24, 70))
>getEither : Symbol(getEither, Decl(arrayFrom.ts, 27, 70))
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
const result1: A[] = Array.from(inputA);
>result1 : Symbol(result1, Decl(arrayFrom.ts, 16, 5))
const inputASet = new Set<A>();
>inputASet : Symbol(inputASet, Decl(arrayFrom.ts, 15, 5))
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
const result1: A[] = Array.from(inputA);
>result1 : Symbol(result1, Decl(arrayFrom.ts, 17, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
const result2: A[] = Array.from(inputA.values());
>result2 : Symbol(result2, Decl(arrayFrom.ts, 17, 5))
>result2 : Symbol(result2, Decl(arrayFrom.ts, 18, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputA.values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
const result3: B[] = Array.from(inputA.values()); // expect error
>result3 : Symbol(result3, Decl(arrayFrom.ts, 18, 5))
>result3 : Symbol(result3, Decl(arrayFrom.ts, 19, 5))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputA.values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
>inputA : Symbol(inputA, Decl(arrayFrom.ts, 11, 5))
>values : Symbol(Array.values, Decl(lib.es2015.iterable.d.ts, --, --))
const result4: A[] = Array.from(inputB, ({ b }): A => ({ a: b }));
>result4 : Symbol(result4, Decl(arrayFrom.ts, 19, 5))
>result4 : Symbol(result4, Decl(arrayFrom.ts, 20, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputB : Symbol(inputB, Decl(arrayFrom.ts, 12, 5))
>b : Symbol(b, Decl(arrayFrom.ts, 19, 42))
>b : Symbol(b, Decl(arrayFrom.ts, 20, 42))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>a : Symbol(a, Decl(arrayFrom.ts, 19, 56))
>b : Symbol(b, Decl(arrayFrom.ts, 19, 42))
>a : Symbol(a, Decl(arrayFrom.ts, 20, 56))
>b : Symbol(b, Decl(arrayFrom.ts, 20, 42))
const result5: A[] = Array.from(inputALike);
>result5 : Symbol(result5, Decl(arrayFrom.ts, 20, 5))
>result5 : Symbol(result5, Decl(arrayFrom.ts, 21, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
const result6: B[] = Array.from(inputALike); // expect error
>result6 : Symbol(result6, Decl(arrayFrom.ts, 21, 5))
>result6 : Symbol(result6, Decl(arrayFrom.ts, 22, 5))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a }));
>result7 : Symbol(result7, Decl(arrayFrom.ts, 22, 5))
>result7 : Symbol(result7, Decl(arrayFrom.ts, 23, 5))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputALike : Symbol(inputALike, Decl(arrayFrom.ts, 13, 5))
>a : Symbol(a, Decl(arrayFrom.ts, 22, 46))
>a : Symbol(a, Decl(arrayFrom.ts, 23, 46))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>b : Symbol(b, Decl(arrayFrom.ts, 22, 60))
>a : Symbol(a, Decl(arrayFrom.ts, 22, 46))
>b : Symbol(b, Decl(arrayFrom.ts, 23, 60))
>a : Symbol(a, Decl(arrayFrom.ts, 23, 46))
const result8: A[] = Array.from(inputARand);
>result8 : Symbol(result8, Decl(arrayFrom.ts, 23, 5))
>result8 : Symbol(result8, Decl(arrayFrom.ts, 24, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
>result9 : Symbol(result9, Decl(arrayFrom.ts, 24, 5))
>result9 : Symbol(result9, Decl(arrayFrom.ts, 25, 5))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputARand : Symbol(inputARand, Decl(arrayFrom.ts, 14, 5))
>a : Symbol(a, Decl(arrayFrom.ts, 24, 46))
>a : Symbol(a, Decl(arrayFrom.ts, 25, 46))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>b : Symbol(b, Decl(arrayFrom.ts, 24, 60))
>a : Symbol(a, Decl(arrayFrom.ts, 24, 46))
>b : Symbol(b, Decl(arrayFrom.ts, 25, 60))
>a : Symbol(a, Decl(arrayFrom.ts, 25, 46))
const result10: A[] = Array.from(new Set<A>());
>result10 : Symbol(result10, Decl(arrayFrom.ts, 26, 5))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Set : Symbol(Set, Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.collection.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>A : Symbol(A, Decl(arrayFrom.ts, 0, 0))
const result11: B[] = Array.from(inputASet, ({ a }): B => ({ b: a }));
>result11 : Symbol(result11, Decl(arrayFrom.ts, 27, 5))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>Array.from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>from : Symbol(ArrayConstructor.from, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
>inputASet : Symbol(inputASet, Decl(arrayFrom.ts, 15, 5))
>a : Symbol(a, Decl(arrayFrom.ts, 27, 46))
>B : Symbol(B, Decl(arrayFrom.ts, 5, 1))
>b : Symbol(b, Decl(arrayFrom.ts, 27, 60))
>a : Symbol(a, Decl(arrayFrom.ts, 27, 46))
// if this is written inline, the compiler seems to infer
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
// even when the type is written as : Iterable<T>|ArrayLike<T>
function getEither<T> (in1: Iterable<T>, in2: ArrayLike<T>) {
>getEither : Symbol(getEither, Decl(arrayFrom.ts, 24, 70))
>T : Symbol(T, Decl(arrayFrom.ts, 29, 19))
>in1 : Symbol(in1, Decl(arrayFrom.ts, 29, 23))
>getEither : Symbol(getEither, Decl(arrayFrom.ts, 27, 70))
>T : Symbol(T, Decl(arrayFrom.ts, 32, 19))
>in1 : Symbol(in1, Decl(arrayFrom.ts, 32, 23))
>Iterable : Symbol(Iterable, Decl(lib.es2015.iterable.d.ts, --, --))
>T : Symbol(T, Decl(arrayFrom.ts, 29, 19))
>in2 : Symbol(in2, Decl(arrayFrom.ts, 29, 40))
>T : Symbol(T, Decl(arrayFrom.ts, 32, 19))
>in2 : Symbol(in2, Decl(arrayFrom.ts, 32, 40))
>ArrayLike : Symbol(ArrayLike, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(arrayFrom.ts, 29, 19))
>T : Symbol(T, Decl(arrayFrom.ts, 32, 19))
return Math.random() > 0.5 ? in1 : in2;
>Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
>Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --))
>in1 : Symbol(in1, Decl(arrayFrom.ts, 29, 23))
>in2 : Symbol(in2, Decl(arrayFrom.ts, 29, 40))
>in1 : Symbol(in1, Decl(arrayFrom.ts, 32, 23))
>in2 : Symbol(in2, Decl(arrayFrom.ts, 32, 40))
}
+51 -18
View File
@@ -41,22 +41,28 @@ const inputARand = getEither(inputA, inputALike);
>inputA : A[]
>inputALike : ArrayLike<A>
const inputASet = new Set<A>();
>inputASet : Set<A>
>new Set<A>() : Set<A>
>Set : SetConstructor
>A : A
const result1: A[] = Array.from(inputA);
>result1 : A[]
>A : A
>Array.from(inputA) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputA : A[]
const result2: A[] = Array.from(inputA.values());
>result2 : A[]
>A : A
>Array.from(inputA.values()) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputA.values() : IterableIterator<A>
>inputA.values : () => IterableIterator<A>
>inputA : A[]
@@ -66,9 +72,9 @@ const result3: B[] = Array.from(inputA.values()); // expect error
>result3 : B[]
>B : B
>Array.from(inputA.values()) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputA.values() : IterableIterator<A>
>inputA.values : () => IterableIterator<A>
>inputA : A[]
@@ -78,9 +84,9 @@ const result4: A[] = Array.from(inputB, ({ b }): A => ({ a: b }));
>result4 : A[]
>A : A
>Array.from(inputB, ({ b }): A => ({ a: b })) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputB : B[]
>({ b }): A => ({ a: b }) : ({ b }: B) => A
>b : string
@@ -94,27 +100,27 @@ const result5: A[] = Array.from(inputALike);
>result5 : A[]
>A : A
>Array.from(inputALike) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputALike : ArrayLike<A>
const result6: B[] = Array.from(inputALike); // expect error
>result6 : B[]
>B : B
>Array.from(inputALike) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputALike : ArrayLike<A>
const result7: B[] = Array.from(inputALike, ({ a }): B => ({ b: a }));
>result7 : B[]
>B : B
>Array.from(inputALike, ({ a }): B => ({ b: a })) : B[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputALike : ArrayLike<A>
>({ a }): B => ({ b: a }) : ({ a }: A) => B
>a : string
@@ -128,18 +134,18 @@ const result8: A[] = Array.from(inputARand);
>result8 : A[]
>A : A
>Array.from(inputARand) : A[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputARand : ArrayLike<A> | Iterable<A>
const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
>result9 : B[]
>B : B
>Array.from(inputARand, ({ a }): B => ({ b: a })) : B[]
>Array.from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputARand : ArrayLike<A> | Iterable<A>
>({ a }): B => ({ b: a }) : ({ a }: A) => B
>a : string
@@ -149,6 +155,33 @@ const result9: B[] = Array.from(inputARand, ({ a }): B => ({ b: a }));
>b : string
>a : string
const result10: A[] = Array.from(new Set<A>());
>result10 : A[]
>A : A
>Array.from(new Set<A>()) : A[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>new Set<A>() : Set<A>
>Set : SetConstructor
>A : A
const result11: B[] = Array.from(inputASet, ({ a }): B => ({ b: a }));
>result11 : B[]
>B : B
>Array.from(inputASet, ({ a }): B => ({ b: a })) : B[]
>Array.from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>Array : ArrayConstructor
>from : { <T>(arrayLike: ArrayLike<T>): T[]; <T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; <T>(iterable: Iterable<T> | ArrayLike<T>): T[]; <T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; }
>inputASet : Set<A>
>({ a }): B => ({ b: a }) : ({ a }: A) => B
>a : string
>B : B
>({ b: a }) : { b: string; }
>{ b: a } : { b: string; }
>b : string
>a : string
// if this is written inline, the compiler seems to infer
// the ?: as always taking the false branch, narrowing to ArrayLike<T>,
// even when the type is written as : Iterable<T>|ArrayLike<T>

Some files were not shown because too many files have changed in this diff Show More