Merge branch 'master' into vfs

This commit is contained in:
Ron Buckton
2018-04-19 16:55:35 -07:00
84 changed files with 2540 additions and 695 deletions
+5
View File
@@ -29,3 +29,8 @@
[submodule "tests/cases/user/puppeteer/puppeteer"]
path = tests/cases/user/puppeteer/puppeteer
url = https://github.com/GoogleChrome/puppeteer.git
ignore = all
[submodule "tests/cases/user/axios-src/axios-src"]
path = tests/cases/user/axios-src/axios-src
url = https://github.com/axios/axios.git
ignore = all
+113 -110
View File
@@ -1,35 +1,27 @@
/// <reference path="scripts/types/ambient.d.ts" />
import * as cp from "child_process";
import * as path from "path";
import * as fs from "fs";
import child_process = require("child_process");
import originalGulp = require("gulp");
import helpMaker = require("gulp-help");
import runSequence = require("run-sequence");
import concat = require("gulp-concat");
import clone = require("gulp-clone");
import newer = require("gulp-newer");
import tsc = require("gulp-typescript");
declare module "gulp-typescript" {
interface Settings {
pretty?: boolean;
newLine?: string;
noImplicitThis?: boolean;
stripInternal?: boolean;
types?: string[];
}
}
import * as insert from "gulp-insert";
import * as sourcemaps from "gulp-sourcemaps";
import Q = require("q");
import del = require("del");
import mkdirP = require("mkdirp");
import minimist = require("minimist");
import browserify = require("browserify");
import through2 = require("through2");
import merge2 = require("merge2");
import * as os from "os";
import fold = require("travis-fold");
// @ts-check
const cp = require("child_process");
const path = require("path");
const fs = require("fs");
const child_process = require("child_process");
const originalGulp = require("gulp");
const helpMaker = require("gulp-help");
const runSequence = require("run-sequence");
const concat = require("gulp-concat");
const clone = require("gulp-clone");
const newer = require("gulp-newer");
const tsc = require("gulp-typescript");
const insert = require("gulp-insert");
const sourcemaps = require("gulp-sourcemaps");
const Q = require("q");
const del = require("del");
const mkdirP = require("mkdirp");
const minimist = require("minimist");
const browserify = require("browserify");
const through2 = require("through2");
const merge2 = require("merge2");
const os = require("os");
const fold = require("travis-fold");
const gulp = helpMaker(originalGulp);
Error.stackTraceLimit = 1000;
@@ -73,17 +65,26 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
});
const noop = () => {}; // tslint:disable-line no-empty
function exec(cmd: string, args: string[], complete: () => void = noop, error: (e: any, status: number) => void = noop) {
/**
* @param {string} cmd
* @param {string[]} args
* @param {() => void} complete
* @param {(e: *, status: number) => void} error
*/
function exec(cmd, args, complete = noop, error = noop) {
console.log(`${cmd} ${args.join(" ")}`);
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
const subshellFlag = isWin ? "/c" : "-c";
const command = isWin ? [possiblyQuote(cmd), ...args] : [`${cmd} ${args.join(" ")}`];
const ex = cp.spawn(isWin ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: "inherit", windowsVerbatimArguments: true } as any);
const ex = cp.spawn(isWin ? "cmd" : "/bin/sh", [subshellFlag, ...command], { stdio: "inherit", windowsVerbatimArguments: true });
ex.on("exit", (code) => code === 0 ? complete() : error(/*e*/ undefined, code));
ex.on("error", error);
}
function possiblyQuote(cmd: string) {
/**
* @param {string} cmd
*/
function possiblyQuote(cmd) {
return cmd.indexOf(" ") >= 0 ? `"${cmd}"` : cmd;
}
@@ -220,7 +221,12 @@ const configurePreleleaseTs = path.join(scriptsDirectory, "configurePrerelease.t
const packageJson = "package.json";
const versionFile = path.join(compilerDirectory, "core.ts");
function needsUpdate(source: string | string[], dest: string | string[]): boolean {
/**
* @param {string | string[]} source
* @param {string | string[]} dest
* @returns {boolean}
*/
function needsUpdate(source, dest) {
if (typeof source === "string" && typeof dest === "string") {
if (fs.existsSync(dest)) {
const {mtime: outTime} = fs.statSync(dest);
@@ -283,8 +289,13 @@ function needsUpdate(source: string | string[], dest: string | string[]): boolea
return true;
}
function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): tsc.Settings {
const copy: tsc.Settings = {};
/**
* @param {tsc.Settings} base
* @param {boolean=} useBuiltCompiler
* @returns {tsc.Settings}
*/
function getCompilerSettings(base, useBuiltCompiler) {
const copy = /** @type {tsc.Settings} */ ({});
for (const key in base) {
copy[key] = base[key];
}
@@ -293,16 +304,17 @@ function getCompilerSettings(base: tsc.Settings, useBuiltCompiler?: boolean): ts
}
copy.newLine = "lf";
if (useBuiltCompiler === true) {
copy.typescript = require("./built/local/typescript.js");
copy.typescript = /** @type {*} */ (require("./built/local/typescript.js"));
}
else if (useBuiltCompiler === false) {
copy.typescript = require("./lib/typescript.js");
copy.typescript = /** @type {*} */ (require("./lib/typescript.js"));
}
return copy;
}
gulp.task(configurePreleleaseJs, /*help*/ false, [], () => {
const settings: tsc.Settings = {
/** @type {tsc.Settings} */
const settings = {
declaration: false,
removeComments: true,
noResolve: false,
@@ -332,7 +344,8 @@ const importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirecto
const importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts");
gulp.task(importDefinitelyTypedTestsJs, /*help*/ false, [], () => {
const settings: tsc.Settings = getCompilerSettings({
/** @type {tsc.Settings} */
const settings = getCompilerSettings({
declaration: false,
removeComments: true,
noResolve: false,
@@ -394,7 +407,8 @@ const generateLocalizedDiagnosticMessagesJs = path.join(scriptsDirectory, "gener
const generateLocalizedDiagnosticMessagesTs = path.join(scriptsDirectory, "generateLocalizedDiagnosticMessages.ts");
gulp.task(generateLocalizedDiagnosticMessagesJs, /*help*/ false, [], () => {
const settings: tsc.Settings = getCompilerSettings({
/** @type {tsc.Settings} */
const settings = getCompilerSettings({
target: "es5",
declaration: false,
removeComments: true,
@@ -425,8 +439,12 @@ const nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
const nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
const nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
let copyrightContent: string;
function prependCopyright(outputCopyright: boolean = !useDebugMode) {
/** @type {string} */
let copyrightContent;
/**
* @param {boolean} outputCopyright
*/
function prependCopyright(outputCopyright = !useDebugMode) {
return insert.prepend(outputCopyright ? (copyrightContent || (copyrightContent = fs.readFileSync(copyright).toString())) : "");
}
@@ -518,9 +536,10 @@ const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverli
gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile, typesMapJson], (done) => {
const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({ removeComments: false }, /*useBuiltCompiler*/ true));
const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src()
/** @type {{ js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream }} */
const {js, dts} = serverLibraryProject.src()
.pipe(sourcemaps.init())
.pipe(newer(<any>{ dest: tsserverLibraryFile, extra: ["src/compiler/**/*.ts", "src/services/**/*.ts"] }))
.pipe(newer(/** @type {*} */({ dest: tsserverLibraryFile, extra: ["src/compiler/**/*.ts", "src/services/**/*.ts"] })))
.pipe(serverLibraryProject());
return merge2([
@@ -555,7 +574,8 @@ const specWord = path.join(docDirectory, "TypeScript Language Specification.docx
const specMd = path.join(docDirectory, "spec.md");
gulp.task(word2mdJs, /*help*/ false, [], () => {
const settings: tsc.Settings = getCompilerSettings({
/** @type {tsc.Settings} */
const settings = getCompilerSettings({
outFile: word2mdJs
}, /*useBuiltCompiler*/ false);
return gulp.src(word2mdTs)
@@ -634,7 +654,8 @@ function deleteTemporaryProjectOutput() {
return del(path.join(localBaseline, "projectOutput/"));
}
let savedNodeEnv: string;
/** @type {string} */
let savedNodeEnv;
function setNodeEnvToDevelopment() {
savedNodeEnv = process.env.NODE_ENV;
process.env.NODE_ENV = "development";
@@ -644,7 +665,12 @@ function restoreSavedNodeEnv() {
process.env.NODE_ENV = savedNodeEnv;
}
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
/**
* @param {string} defaultReporter
* @param {boolean} runInParallel
* @param {(e?: any) => void} done
*/
function runConsoleTests(defaultReporter, runInParallel, done) {
const lintFlag = cmdLineOptions.lint;
cleanTestDirs((err) => {
if (err) { console.error(err); failWithStatus(err, 1); }
@@ -719,7 +745,11 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
}
});
function failWithStatus(err?: any, status?: number) {
/**
* @param {any=} err
* @param {number=} status
*/
function failWithStatus(err, status) {
if (err || status) {
process.exit(typeof status === "number" ? status : 2);
}
@@ -735,7 +765,11 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
}
}
function finish(error?: any, errorStatus?: number) {
/**
* @param {any=} error
* @param {number=} errorStatus
*/
function finish(error, errorStatus) {
restoreSavedNodeEnv();
deleteTestConfig().then(deleteTemporaryProjectOutput).then(() => {
if (error !== undefined || errorStatus !== undefined) {
@@ -765,7 +799,8 @@ gulp.task("runtests",
const nodeServerOutFile = "tests/webTestServer.js";
const nodeServerInFile = "tests/webTestServer.ts";
gulp.task(nodeServerOutFile, /*help*/ false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ true);
/** @type {tsc.Settings} */
const settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ true);
return gulp.src(nodeServerInFile)
.pipe(newer(nodeServerOutFile))
.pipe(sourcemaps.init())
@@ -774,16 +809,18 @@ gulp.task(nodeServerOutFile, /*help*/ false, [servicesFile], () => {
.pipe(gulp.dest(path.dirname(nodeServerOutFile)));
});
import convertMap = require("convert-source-map");
import sorcery = require("sorcery");
import Vinyl = require("vinyl");
const convertMap = require("convert-source-map");
const sorcery = require("sorcery");
const Vinyl = require("vinyl");
const bundlePath = path.resolve("built/local/bundle.js");
gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: bundlePath, inlineSourceMap: true }, /*useBuiltCompiler*/ true));
let originalMap: any;
let prebundledContent: string;
/** @type {*} */
let originalMap;
/** @type {string} */
let prebundledContent;
browserify(testProject.src()
.pipe(newer(bundlePath))
.pipe(sourcemaps.init())
@@ -847,8 +884,10 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
});
});
function cleanTestDirs(done: (e?: any) => void) {
/**
* @param {(e?: any) => void} done
*/
function cleanTestDirs(done) {
// Clean the local baselines & Rwc baselines directories
del([
localBaseline,
@@ -864,8 +903,17 @@ function cleanTestDirs(done: (e?: any) => void) {
});
}
// used to pass data from jake command line directly to run.js
function writeTestConfigFile(tests: string, runners: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string, timeout?: number) {
/**
* used to pass data from jake command line directly to run.js
* @param {string} tests
* @param {string} runners
* @param {boolean} light
* @param {string=} taskConfigsFolder
* @param {number=} workerCount
* @param {string=} stackTraceLimit
* @param {number=} timeout
*/
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout) {
const testConfigContents = JSON.stringify({
test: tests ? [tests] : undefined,
runner: runners ? runners.split(",") : undefined,
@@ -966,7 +1014,7 @@ gulp.task("baseline-accept-test262", "Makes the most recent test262 test results
const webhostPath = "tests/webhost/webtsc.ts";
const webhostJsPath = "tests/webhost/webtsc.js";
gulp.task(webhostJsPath, /*help*/ false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({
const settings = getCompilerSettings({
outFile: webhostJsPath
}, /*useBuiltCompiler*/ true);
return gulp.src(webhostPath)
@@ -986,7 +1034,7 @@ gulp.task("webhost", "Builds the tsc web host", [webhostJsPath], () => {
const perftscPath = "tests/perftsc.ts";
const perftscJsPath = "built/local/perftsc.js";
gulp.task(perftscJsPath, /*help*/ false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({
const settings = getCompilerSettings({
outFile: perftscJsPath
}, /*useBuiltCompiler*/ true);
return gulp.src(perftscPath)
@@ -1017,7 +1065,7 @@ gulp.task(loggedIOJsPath, /*help*/ false, [], (done) => {
const instrumenterPath = path.join(harnessDirectory, "instrumenter.ts");
const instrumenterJsPath = path.join(builtLocalDirectory, "instrumenter.js");
gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
const settings: tsc.Settings = getCompilerSettings({
const settings = getCompilerSettings({
module: "commonjs",
target: "es5",
lib: [
@@ -1044,7 +1092,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
});
gulp.task("build-rules", "Compiles tslint rules to js", () => {
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", lib: ["es6"] }, /*useBuiltCompiler*/ false);
const settings = getCompilerSettings({ module: "commonjs", lib: ["es6"] }, /*useBuiltCompiler*/ false);
const dest = path.join(builtLocalDirectory, "tslint");
return gulp.src("scripts/tslint/**/*.ts")
.pipe(newer({
@@ -1057,51 +1105,6 @@ gulp.task("build-rules", "Compiles tslint rules to js", () => {
.pipe(gulp.dest(dest));
});
const lintTargets = [
"Gulpfile.ts",
"src/compiler/**/*.ts",
"src/harness/**/*.ts",
"!src/harness/unittests/services/formatting/**/*.ts",
"src/server/**/*.ts",
"scripts/tslint/**/*.ts",
"src/services/**/*.ts",
"tests/*.ts", "tests/webhost/*.ts" // Note: does *not* descend recursively
];
function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback: (failures: number) => void, failures: number) {
const file = files.pop();
if (file) {
console.log(`Linting '${file.path}'.`);
child.send({ kind: "file", name: file.path });
}
else {
child.send({ kind: "close" });
callback(failures);
}
}
function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) {
const child = cp.fork("./scripts/parallel-lint");
let failures = 0;
child.on("message", data => {
switch (data.kind) {
case "result":
if (data.failures > 0) {
failures += data.failures;
console.log(data.output);
}
sendNextFile(files, child, callback, failures);
break;
case "error":
console.error(data.error);
failures++;
sendNextFile(files, child, callback, failures);
break;
}
});
sendNextFile(files, child, callback, failures);
}
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
if (fold.isTravis()) console.log(fold.start("lint"));
for (const project of ["scripts/tslint/tsconfig.json", "src/tsconfig-base.json"]) {
-1
View File
@@ -78,7 +78,6 @@
"source-map-support": "latest",
"through2": "latest",
"travis-fold": "latest",
"ts-node": "latest",
"tslint": "latest",
"vinyl": "latest",
"chalk": "latest",
+60 -30
View File
@@ -1554,7 +1554,8 @@ namespace ts {
function isTypeParameterSymbolDeclaredInContainer(symbol: Symbol, container: Node) {
for (const decl of symbol.declarations) {
if (decl.kind === SyntaxKind.TypeParameter && decl.parent === container) {
const parent = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent;
if (decl.kind === SyntaxKind.TypeParameter && parent === container) {
return true;
}
}
@@ -2060,10 +2061,10 @@ namespace ts {
let symbol: Symbol;
if (name.kind === SyntaxKind.Identifier) {
const message = meaning === namespaceMeaning ? Diagnostics.Cannot_find_namespace_0 : Diagnostics.Cannot_find_name_0;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors ? undefined : message, name, /*isUse*/ true);
const symbolFromJSPrototype = isInJavaScriptFile(name) && resolveEntityNameFromJSPrototype(name, meaning);
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return undefined;
return symbolFromJSPrototype;
}
}
else if (name.kind === SyntaxKind.QualifiedName || name.kind === SyntaxKind.PropertyAccessExpression) {
@@ -2114,6 +2115,18 @@ namespace ts {
return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol);
}
function resolveEntityNameFromJSPrototype(name: Identifier, meaning: SymbolFlags) {
if (isJSDocTypeReference(name.parent) && isJSDocTag(name.parent.parent.parent)) {
const host = getJSDocHost(name.parent.parent.parent as JSDocTag);
if (isExpressionStatement(host) &&
isBinaryExpression(host.expression) &&
getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) {
const secondaryLocation = getSymbolOfNode(host.expression.left).parent.valueDeclaration;
return resolveName(secondaryLocation, name.escapedText, meaning, /*nameNotFoundMessage*/ undefined, name, /*isUse*/ true);
}
}
}
function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol {
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, Diagnostics.Cannot_find_module_0);
}
@@ -4897,8 +4910,7 @@ namespace ts {
// in-place and returns the same array.
function appendTypeParameters(typeParameters: TypeParameter[], declarations: ReadonlyArray<TypeParameterDeclaration>): TypeParameter[] {
for (const declaration of declarations) {
const tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration));
typeParameters = appendIfUnique(typeParameters, tp);
typeParameters = appendIfUnique(typeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)));
}
return typeParameters;
}
@@ -4958,8 +4970,9 @@ namespace ts {
if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.ClassDeclaration ||
node.kind === SyntaxKind.ClassExpression || node.kind === SyntaxKind.TypeAliasDeclaration) {
const declaration = <InterfaceDeclaration | TypeAliasDeclaration>node;
if (declaration.typeParameters) {
result = appendTypeParameters(result, declaration.typeParameters);
const typeParameters = getEffectiveTypeParameterDeclarations(declaration);
if (typeParameters) {
result = appendTypeParameters(result, typeParameters);
}
}
}
@@ -5455,9 +5468,10 @@ namespace ts {
*/
function isThislessFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
const returnType = getEffectiveReturnTypeNode(node);
const typeParameters = getEffectiveTypeParameterDeclarations(node);
return (node.kind === SyntaxKind.Constructor || (returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
(!node.typeParameters || node.typeParameters.every(isThislessTypeParameter));
(!typeParameters || typeParameters.every(isThislessTypeParameter));
}
/**
@@ -6735,8 +6749,7 @@ namespace ts {
function getTypeParametersFromDeclaration(declaration: DeclarationWithTypeParameters): TypeParameter[] {
let result: TypeParameter[];
forEach(getEffectiveTypeParameterDeclarations(declaration), node => {
const tp = getDeclaredTypeOfTypeParameter(node.symbol);
result = appendIfUnique(result, tp);
result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
});
return result;
}
@@ -7547,7 +7560,7 @@ namespace ts {
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node: NodeWithTypeArguments): node is TypeReferenceNode {
function isJSDocTypeReference(node: Node): node is TypeReferenceNode {
return node.flags & NodeFlags.JSDoc && node.kind === SyntaxKind.TypeReference;
}
@@ -9170,10 +9183,15 @@ namespace ts {
// aren't the right hand side of a generic type alias declaration we optimize by reducing the
// set of type parameters to those that are possibly referenced in the literal.
const declaration = symbol.declarations[0];
const outerTypeParameters = getOuterTypeParameters(declaration, /*includeThisTypes*/ true) || emptyArray;
let outerTypeParameters = getOuterTypeParameters(declaration, /*includeThisTypes*/ true);
if (isJavaScriptConstructor(declaration)) {
const templateTagParameters = getTypeParametersFromDeclaration(declaration as DeclarationWithTypeParameters);
outerTypeParameters = addRange(outerTypeParameters, templateTagParameters);
}
typeParameters = outerTypeParameters || emptyArray;
typeParameters = symbol.flags & SymbolFlags.TypeLiteral && !target.aliasTypeArguments ?
filter(outerTypeParameters, tp => isTypeParameterPossiblyReferenced(tp, declaration)) :
outerTypeParameters;
filter(typeParameters, tp => isTypeParameterPossiblyReferenced(tp, declaration)) :
typeParameters;
links.outerTypeParameters = typeParameters;
if (typeParameters.length) {
links.instantiations = createMap<Type>();
@@ -17749,11 +17767,11 @@ namespace ts {
let typeArguments: NodeArray<TypeNode>;
if (!isTaggedTemplate && !isDecorator && !isJsxOpeningOrSelfClosingElement) {
if (!isDecorator && !isJsxOpeningOrSelfClosingElement) {
typeArguments = (<CallExpression>node).typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
if ((<CallExpression>node).expression.kind !== SyntaxKind.SuperKeyword) {
if (isTaggedTemplate || (<CallExpression>node).expression.kind !== SyntaxKind.SuperKeyword) {
forEach(typeArguments, checkSourceElement);
}
}
@@ -17866,7 +17884,7 @@ namespace ts {
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true);
}
else if (candidateForTypeArgumentError) {
checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression).typeArguments, /*reportErrors*/ true, fallbackError);
checkTypeArguments(candidateForTypeArgumentError, (node as CallExpression | TaggedTemplateExpression).typeArguments, /*reportErrors*/ true, fallbackError);
}
else if (typeArguments && every(signatures, sig => length(sig.typeParameters) !== typeArguments.length)) {
diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments));
@@ -18533,7 +18551,7 @@ namespace ts {
}
const type = funcSymbol && getJavaScriptClassType(funcSymbol);
if (type) {
return type;
return signature.target ? instantiateType(type, signature.mapper) : type;
}
if (noImplicitAny) {
error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type);
@@ -18660,6 +18678,7 @@ namespace ts {
}
function checkTaggedTemplateExpression(node: TaggedTemplateExpression): Type {
checkGrammarTypeArguments(node, node.typeArguments);
if (languageVersion < ScriptTarget.ES2015) {
checkExternalEmitHelpers(node, ExternalEmitHelpers.MakeTemplateObject);
}
@@ -21865,6 +21884,11 @@ namespace ts {
// If the node had `@property` tags, `typeExpression` would have been set to the first property tag.
error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
}
if (node.name) {
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
}
checkSourceElement(node.typeExpression);
}
function checkJSDocParameterTag(node: JSDocParameterTag) {
@@ -22155,8 +22179,9 @@ namespace ts {
): void {
// Only report errors on the last declaration for the type parameter container;
// this ensures that all uses have been accounted for.
if (!(node.flags & NodeFlags.Ambient) && node.typeParameters && last(getSymbolOfNode(node)!.declarations) === node) {
for (const typeParameter of node.typeParameters) {
const typeParameters = getEffectiveTypeParameterDeclarations(node);
if (!(node.flags & NodeFlags.Ambient) && typeParameters && last(getSymbolOfNode(node)!.declarations) === node) {
for (const typeParameter of typeParameters) {
if (!(getMergedSymbol(typeParameter.symbol).isReferenced & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderScore(typeParameter.name)) {
addDiagnostic(UnusedKind.Parameter, createDiagnosticForNode(typeParameter.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolName(typeParameter.symbol)));
}
@@ -23530,20 +23555,21 @@ namespace ts {
}
}
function areTypeParametersIdentical(declarations: ReadonlyArray<ClassDeclaration | InterfaceDeclaration>, typeParameters: TypeParameter[]) {
const maxTypeArgumentCount = length(typeParameters);
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
function areTypeParametersIdentical(declarations: ReadonlyArray<ClassDeclaration | InterfaceDeclaration>, targetParameters: TypeParameter[]) {
const maxTypeArgumentCount = length(targetParameters);
const minTypeArgumentCount = getMinTypeArgumentCount(targetParameters);
for (const declaration of declarations) {
// If this declaration has too few or too many type parameters, we report an error
const numTypeParameters = length(declaration.typeParameters);
const sourceParameters = getEffectiveTypeParameterDeclarations(declaration);
const numTypeParameters = length(sourceParameters);
if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) {
return false;
}
for (let i = 0; i < numTypeParameters; i++) {
const source = declaration.typeParameters[i];
const target = typeParameters[i];
const source = sourceParameters[i];
const target = targetParameters[i];
// If the type parameter node does not have the same as the resolved type
// parameter at this position, we report an error.
@@ -23604,7 +23630,7 @@ namespace ts {
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
checkTypeParameters(node.typeParameters);
checkTypeParameters(getEffectiveTypeParameterDeclarations(node));
checkExportsOnMergedDeclarations(node);
const symbol = getSymbolOfNode(node);
const type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
@@ -24465,7 +24491,10 @@ namespace ts {
checkImportBinding(importClause.namedBindings);
}
else {
forEach(importClause.namedBindings.elements, checkImportBinding);
const moduleExisted = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleExisted) {
forEach(importClause.namedBindings.elements, checkImportBinding);
}
}
}
}
@@ -24762,6 +24791,7 @@ namespace ts {
case SyntaxKind.JSDocNullableType:
case SyntaxKind.JSDocAllType:
case SyntaxKind.JSDocUnknownType:
case SyntaxKind.JSDocTypeLiteral:
checkJSDocTypeIsInJsFile(node);
forEachChild(node, checkSourceElement);
return;
@@ -26836,7 +26866,7 @@ namespace ts {
function checkGrammarClassLikeDeclaration(node: ClassLikeDeclaration): boolean {
const file = getSourceFileOfNode(node);
return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(node.typeParameters, file);
return checkGrammarClassDeclarationHeritageClauses(node) || checkGrammarTypeParameterList(getEffectiveTypeParameterDeclarations(node), file);
}
function checkGrammarArrowFunction(node: Node, file: SourceFile): boolean {
+5 -4
View File
@@ -2987,18 +2987,19 @@ namespace ts {
}
/** Remove the *first* occurrence of `item` from the array. */
export function unorderedRemoveItem<T>(array: T[], item: T): void {
unorderedRemoveFirstItemWhere(array, element => element === item);
export function unorderedRemoveItem<T>(array: T[], item: T) {
return unorderedRemoveFirstItemWhere(array, element => element === item);
}
/** Remove the *first* element satisfying `predicate`. */
function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean): void {
function unorderedRemoveFirstItemWhere<T>(array: T[], predicate: (element: T) => boolean) {
for (let i = 0; i < array.length; i++) {
if (predicate(array[i])) {
unorderedRemoveItemAt(array, i);
break;
return true;
}
}
return false;
}
export type GetCanonicalFileName = (fileName: string) => string;
+2 -2
View File
@@ -3914,7 +3914,7 @@
"category": "Message",
"code": 90007
},
"Add 'this.' to unresolved variable": {
"Add '{0}.' to unresolved variable": {
"category": "Message",
"code": 90008
},
@@ -4122,7 +4122,7 @@
"category": "Message",
"code": 95036
},
"Add 'this.' to all unresolved variables matching a member name": {
"Add qualifier to all unresolved variables matching a member name": {
"category": "Message",
"code": 95037
},
+1
View File
@@ -1463,6 +1463,7 @@ namespace ts {
function emitTaggedTemplateExpression(node: TaggedTemplateExpression) {
emitExpression(node.tag);
emitTypeArguments(node, node.typeArguments);
writeSpace();
emitExpression(node.template);
}
+20 -5
View File
@@ -1032,17 +1032,32 @@ namespace ts {
: node;
}
export function createTaggedTemplate(tag: Expression, template: TemplateLiteral) {
export function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
export function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
/** @internal */
export function createTaggedTemplate(tag: Expression, typeArgumentsOrTemplate: ReadonlyArray<TypeNode> | TemplateLiteral, template?: TemplateLiteral): TaggedTemplateExpression;
export function createTaggedTemplate(tag: Expression, typeArgumentsOrTemplate: ReadonlyArray<TypeNode> | TemplateLiteral, template?: TemplateLiteral) {
const node = <TaggedTemplateExpression>createSynthesizedNode(SyntaxKind.TaggedTemplateExpression);
node.tag = parenthesizeForAccess(tag);
node.template = template;
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate as ReadonlyArray<TypeNode>);
node.template = template!;
}
else {
node.typeArguments = undefined;
node.template = typeArgumentsOrTemplate as TemplateLiteral;
}
return node;
}
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral) {
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
export function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArgumentsOrTemplate: ReadonlyArray<TypeNode> | TemplateLiteral, template?: TemplateLiteral) {
return node.tag !== tag
|| node.template !== template
? updateNode(createTaggedTemplate(tag, template), node)
|| (template
? node.typeArguments !== typeArgumentsOrTemplate || node.template !== template
: node.typeArguments !== undefined || node.template !== typeArgumentsOrTemplate)
? updateNode(createTaggedTemplate(tag, typeArgumentsOrTemplate, template), node)
: node;
}
+42 -11
View File
@@ -223,6 +223,7 @@ namespace ts {
visitNodes(cbNode, cbNodes, (<CallExpression>node).arguments);
case SyntaxKind.TaggedTemplateExpression:
return visitNode(cbNode, (<TaggedTemplateExpression>node).tag) ||
visitNodes(cbNode, cbNodes, (<TaggedTemplateExpression>node).typeArguments) ||
visitNode(cbNode, (<TaggedTemplateExpression>node).template);
case SyntaxKind.TypeAssertionExpression:
return visitNode(cbNode, (<TypeAssertion>node).type) ||
@@ -4362,13 +4363,8 @@ namespace ts {
continue;
}
if (token() === SyntaxKind.NoSubstitutionTemplateLiteral || token() === SyntaxKind.TemplateHead) {
const tagExpression = <TaggedTemplateExpression>createNode(SyntaxKind.TaggedTemplateExpression, expression.pos);
tagExpression.tag = expression;
tagExpression.template = token() === SyntaxKind.NoSubstitutionTemplateLiteral
? <NoSubstitutionTemplateLiteral>parseLiteralNode()
: parseTemplateExpression();
expression = finishNode(tagExpression);
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(expression, /*typeArguments*/ undefined);
continue;
}
@@ -4376,6 +4372,20 @@ namespace ts {
}
}
function isTemplateStartOfTaggedTemplate() {
return token() === SyntaxKind.NoSubstitutionTemplateLiteral || token() === SyntaxKind.TemplateHead;
}
function parseTaggedTemplateRest(tag: LeftHandSideExpression, typeArguments: NodeArray<TypeNode> | undefined) {
const tagExpression = <TaggedTemplateExpression>createNode(SyntaxKind.TaggedTemplateExpression, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === SyntaxKind.NoSubstitutionTemplateLiteral
? <NoSubstitutionTemplateLiteral>parseLiteralNode()
: parseTemplateExpression();
return finishNode(tagExpression);
}
function parseCallExpressionRest(expression: LeftHandSideExpression): LeftHandSideExpression {
while (true) {
expression = parseMemberExpressionRest(expression);
@@ -4389,6 +4399,11 @@ namespace ts {
return expression;
}
if (isTemplateStartOfTaggedTemplate()) {
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
const callExpr = <CallExpression>createNode(SyntaxKind.CallExpression, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
@@ -4436,8 +4451,10 @@ namespace ts {
function canFollowTypeArgumentsInExpression(): boolean {
switch (token()) {
case SyntaxKind.OpenParenToken: // foo<x>(
// this case are the only case where this token can legally follow a type argument
// list. So we definitely want to treat this as a type arg list.
case SyntaxKind.NoSubstitutionTemplateLiteral: // foo<T> `...`
case SyntaxKind.TemplateHead: // foo<T> `...${100}...`
// these are the only tokens can legally follow a type argument
// list. So we definitely want to treat them as type arg lists.
case SyntaxKind.DotToken: // foo<x>.
case SyntaxKind.CloseParenToken: // foo<x>)
@@ -4666,9 +4683,23 @@ namespace ts {
return finishNode(node);
}
let expression: MemberExpression = parsePrimaryExpression();
let typeArguments;
while (true) {
expression = parseMemberExpressionRest(expression);
typeArguments = tryParse(parseTypeArgumentsInExpression);
if (isTemplateStartOfTaggedTemplate()) {
Debug.assert(!!typeArguments,
"Expected a type argument list; all plain tagged template starts should be consumed in 'parseMemberExpressionRest'");
expression = parseTaggedTemplateRest(expression, typeArguments);
typeArguments = undefined;
}
break;
}
const node = <NewExpression>createNode(SyntaxKind.NewExpression, fullStart);
node.expression = parseMemberExpressionOrHigher();
node.typeArguments = tryParse(parseTypeArgumentsInExpression);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === SyntaxKind.OpenParenToken) {
node.arguments = parseArgumentList();
}
+5 -1
View File
@@ -1624,6 +1624,9 @@ namespace ts {
collectDynamicImportOrRequireCalls(node);
}
}
if ((file.flags & NodeFlags.PossiblyContainsDynamicImport) || isJavaScriptFile) {
collectDynamicImportOrRequireCalls(file.endOfFileToken);
}
file.imports = imports || emptyArray;
file.moduleAugmentations = moduleAugmentations || emptyArray;
@@ -2004,7 +2007,8 @@ namespace ts {
&& !options.noResolve
&& i < file.imports.length
&& !elideImport
&& !(isJsFile && !options.allowJs);
&& !(isJsFile && !options.allowJs)
&& (isInJavaScriptFile(file.imports[i]) || !(file.imports[i].flags & NodeFlags.JSDoc));
if (elideImport) {
modulesWithElidedImports.set(file.path, true);
+26 -4
View File
@@ -10,6 +10,7 @@ namespace ts {
invalidateResolutionOfFile(filePath: Path): void;
removeResolutionsOfFile(filePath: Path): void;
setFilesWithInvalidatedNonRelativeUnresolvedImports(filesWithUnresolvedImports: Map<ReadonlyArray<string>>): void;
createHasInvalidatedResolution(forceAllFilesAsInvalidated?: boolean): HasInvalidatedResolution;
startCachingPerDirectoryResolution(): void;
@@ -74,6 +75,7 @@ namespace ts {
export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootDirForResolution: string, logChangesWhenResolvingModule: boolean): ResolutionCache {
let filesWithChangedSetOfUnresolvedImports: Path[] | undefined;
let filesWithInvalidatedResolutions: Map<true> | undefined;
let filesWithInvalidatedNonRelativeUnresolvedImports: Map<ReadonlyArray<string>> | undefined;
let allFilesHaveInvalidatedResolution = false;
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
@@ -122,6 +124,7 @@ namespace ts {
resolveTypeReferenceDirectives,
removeResolutionsOfFile,
invalidateResolutionOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution,
updateTypeRootsWatch,
closeTypeRootsWatch,
@@ -165,6 +168,16 @@ namespace ts {
return collected;
}
function isFileWithInvalidatedNonRelativeUnresolvedImports(path: Path) {
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
return false;
}
// Invalidated if file has unresolved imports
const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
return value && !!value.length;
}
function createHasInvalidatedResolution(forceAllFilesAsInvalidated?: boolean): HasInvalidatedResolution {
if (allFilesHaveInvalidatedResolution || forceAllFilesAsInvalidated) {
// Any file asked would have invalidated resolution
@@ -173,7 +186,8 @@ namespace ts {
}
const collected = filesWithInvalidatedResolutions;
filesWithInvalidatedResolutions = undefined;
return path => collected && collected.has(path);
return path => (collected && collected.has(path)) ||
isFileWithInvalidatedNonRelativeUnresolvedImports(path);
}
function clearPerDirectoryResolutions() {
@@ -184,6 +198,7 @@ namespace ts {
function finishCachingPerDirectoryResolution() {
allFilesHaveInvalidatedResolution = false;
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
directoryWatchesOfFailedLookups.forEach((watcher, path) => {
if (watcher.refCount === 0) {
directoryWatchesOfFailedLookups.delete(path);
@@ -237,13 +252,15 @@ namespace ts {
const resolvedModules: R[] = [];
const compilerOptions = resolutionHost.getCompilationSettings();
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
const seenNamesInFile = createMap<true>();
for (const name of names) {
let resolution = resolutionsInFile.get(name);
// Resolution is valid if it is present and not invalidated
if (!seenNamesInFile.has(name) &&
allFilesHaveInvalidatedResolution || !resolution || resolution.isInvalidated) {
allFilesHaveInvalidatedResolution || !resolution || resolution.isInvalidated ||
// If the name is unresolved import that was invalidated, recalculate
(hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && !getResolutionWithResolvedFileName(resolution))) {
const existingResolution = resolution;
const resolutionInDirectory = perDirectoryResolution.get(name);
if (resolutionInDirectory) {
@@ -284,7 +301,7 @@ namespace ts {
if (oldResolution === newResolution) {
return true;
}
if (!oldResolution || !newResolution || oldResolution.isInvalidated) {
if (!oldResolution || !newResolution) {
return false;
}
const oldResult = getResolutionWithResolvedFileName(oldResolution);
@@ -577,6 +594,11 @@ namespace ts {
);
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap: Map<ReadonlyArray<string>>) {
Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
}
function invalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath: Path, isCreatingWatchedDirectory: boolean) {
let isChangedFailedLookupLocation: (location: string) => boolean;
if (isCreatingWatchedDirectory) {
+4
View File
@@ -428,6 +428,7 @@ namespace ts {
newLine: string;
useCaseSensitiveFileNames: boolean;
write(s: string): void;
writeOutputIsTTY?(): boolean;
readFile(path: string, encoding?: string): string | undefined;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
@@ -561,6 +562,9 @@ namespace ts {
write(s: string): void {
process.stdout.write(s);
},
writeOutputIsTTY() {
return process.stdout.isTTY;
},
readFile,
writeFile,
watchFile: getWatchFile(),
+11
View File
@@ -502,6 +502,9 @@ namespace ts {
case SyntaxKind.NewExpression:
return visitNewExpression(<NewExpression>node);
case SyntaxKind.TaggedTemplateExpression:
return visitTaggedTemplateExpression(<TaggedTemplateExpression>node);
case SyntaxKind.NonNullExpression:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(<NonNullExpression>node);
@@ -2547,6 +2550,14 @@ namespace ts {
visitNodes(node.arguments, visitor, isExpression));
}
function visitTaggedTemplateExpression(node: TaggedTemplateExpression) {
return updateTaggedTemplate(
node,
visitNode(node.tag, visitor, isExpression),
/*typeArguments*/ undefined,
visitNode(node.template, visitor, isExpression));
}
/**
* Determines whether to emit an enum declaration.
*
+9 -2
View File
@@ -19,11 +19,18 @@ namespace ts {
let reportDiagnostic = createDiagnosticReporter(sys);
function updateReportDiagnostic(options: CompilerOptions) {
if (options.pretty) {
if (shouldBePretty(options)) {
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
}
}
function shouldBePretty(options: CompilerOptions) {
if (typeof options.pretty === "undefined") {
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
}
return options.pretty;
}
function padLeft(s: string, length: number) {
while (s.length < length) {
s = " " + s;
@@ -159,7 +166,7 @@ namespace ts {
}
function createWatchStatusReporter(options: CompilerOptions) {
return ts.createWatchStatusReporter(sys, !!options.pretty);
return ts.createWatchStatusReporter(sys, shouldBePretty(options));
}
function createWatchOfConfigFile(configParseResult: ParsedCommandLine, optionsToExtend: CompilerOptions) {
+5 -9
View File
@@ -1727,6 +1727,7 @@ namespace ts {
export interface TaggedTemplateExpression extends MemberExpression {
kind: SyntaxKind.TaggedTemplateExpression;
tag: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
template: TemplateLiteral;
}
@@ -1892,7 +1893,7 @@ namespace ts {
kind: SyntaxKind.DebuggerStatement;
}
export interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
export interface MissingDeclaration extends DeclarationStatement {
kind: SyntaxKind.MissingDeclaration;
name?: Identifier;
}
@@ -3193,7 +3194,8 @@ namespace ts {
export type AnyValidImportOrReExport =
| (ImportDeclaration | ExportDeclaration) & { moduleSpecifier: StringLiteral }
| ImportEqualsDeclaration & { moduleReference: ExternalModuleReference & { expression: StringLiteral } }
| RequireOrImportCall;
| RequireOrImportCall
| ImportTypeNode & { argument: LiteralType };
/* @internal */
export type RequireOrImportCall = CallExpression & { arguments: [StringLiteralLike] };
@@ -4194,7 +4196,7 @@ namespace ts {
preserveSymlinks?: boolean;
/* @internal */ preserveWatchOutput?: boolean;
project?: string;
/* @internal */ pretty?: DiagnosticStyle;
/* @internal */ pretty?: boolean;
reactNamespace?: string;
jsxFactory?: string;
removeComments?: boolean;
@@ -4292,12 +4294,6 @@ namespace ts {
JSX,
}
/* @internal */
export const enum DiagnosticStyle {
Simple,
Pretty,
}
/** Either a parsed command line or a parsed tsconfig.json */
export interface ParsedCommandLine {
options: CompilerOptions;
+12 -9
View File
@@ -1710,8 +1710,10 @@ namespace ts {
return (node.parent as ExternalModuleReference).parent as AnyValidImportOrReExport;
case SyntaxKind.CallExpression:
return node.parent as AnyValidImportOrReExport;
case SyntaxKind.LiteralType:
return cast(node.parent.parent, isImportTypeNode) as ImportTypeNode & { argument: LiteralType };
default:
return Debug.fail(Debug.showSyntaxKind(node));
return Debug.fail(Debug.showSyntaxKind(node.parent));
}
}
@@ -3053,11 +3055,11 @@ namespace ts {
* Gets the effective type parameters. If the node was parsed in a
* JavaScript file, gets the type parameters from the `@template` tag from JSDoc.
*/
export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray<TypeParameterDeclaration> | undefined {
export function getEffectiveTypeParameterDeclarations(node: DeclarationWithTypeParameters) {
return node.typeParameters || (isInJavaScriptFile(node) ? getJSDocTypeParameterDeclarations(node) : undefined);
}
export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray<TypeParameterDeclaration> {
export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters) {
const templateTag = getJSDocTemplateTag(node);
return templateTag && templateTag.typeParameters;
}
@@ -4926,6 +4928,10 @@ namespace ts {
return node.kind === SyntaxKind.LiteralType;
}
export function isImportTypeNode(node: Node): node is ImportTypeNode {
return node.kind === SyntaxKind.ImportType;
}
// Binding patterns
export function isObjectBindingPattern(node: Node): node is ObjectBindingPattern {
@@ -5606,8 +5612,7 @@ namespace ts {
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.IndexSignature
|| kind === SyntaxKind.SemicolonClassElement
|| kind === SyntaxKind.MissingDeclaration;
|| kind === SyntaxKind.SemicolonClassElement;
}
export function isClassLike(node: Node): node is ClassLikeDeclaration {
@@ -5638,8 +5643,7 @@ namespace ts {
|| kind === SyntaxKind.CallSignature
|| kind === SyntaxKind.PropertySignature
|| kind === SyntaxKind.MethodSignature
|| kind === SyntaxKind.IndexSignature
|| kind === SyntaxKind.MissingDeclaration;
|| kind === SyntaxKind.IndexSignature;
}
export function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement {
@@ -5653,8 +5657,7 @@ namespace ts {
|| kind === SyntaxKind.SpreadAssignment
|| kind === SyntaxKind.MethodDeclaration
|| kind === SyntaxKind.GetAccessor
|| kind === SyntaxKind.SetAccessor
|| kind === SyntaxKind.MissingDeclaration;
|| kind === SyntaxKind.SetAccessor;
}
// Type
+1
View File
@@ -478,6 +478,7 @@ namespace ts {
case SyntaxKind.TaggedTemplateExpression:
return updateTaggedTemplate(<TaggedTemplateExpression>node,
visitNode((<TaggedTemplateExpression>node).tag, visitor, isExpression),
visitNodes((<TaggedTemplateExpression>node).typeArguments, visitor, isExpression),
visitNode((<TaggedTemplateExpression>node).template, visitor, isTemplateLiteral));
case SyntaxKind.TypeAssertionExpression:
+15 -8
View File
@@ -2113,14 +2113,11 @@ Actual: ${stringify(fullActual)}`);
this.raiseError("verifyRangesInImplementationList failed - expected to find at least one implementation location but got 0");
}
for (let i = 0; i < implementations.length; i++) {
for (let j = 0; j < implementations.length; j++) {
if (i !== j && implementationsAreEqual(implementations[i], implementations[j])) {
const { textSpan, fileName } = implementations[i];
const end = textSpan.start + textSpan.length;
this.raiseError(`Duplicate implementations returned for range (${textSpan.start}, ${end}) in ${fileName}`);
}
}
const duplicate = findDuplicatedElement(implementations, implementationsAreEqual);
if (duplicate) {
const { textSpan, fileName } = duplicate;
const end = textSpan.start + textSpan.length;
this.raiseError(`Duplicate implementations returned for range (${textSpan.start}, ${end}) in ${fileName}`);
}
const ranges = this.getRanges();
@@ -3766,6 +3763,16 @@ ${code}
function stripWhitespace(s: string): string {
return s.replace(/\s/g, "");
}
function findDuplicatedElement<T>(a: ReadonlyArray<T>, equal: (a: T, b: T) => boolean): T {
for (let i = 0; i < a.length; i++) {
for (let j = i + 1; j < a.length; j++) {
if (equal(a[i], a[j])) {
return a[i];
}
}
}
}
}
namespace FourSlashInterface {
@@ -13,7 +13,9 @@ namespace ts.projectSystem {
export import checkArray = TestFSWithWatch.checkArray;
export import libFile = TestFSWithWatch.libFile;
export import checkWatchedFiles = TestFSWithWatch.checkWatchedFiles;
import checkWatchedDirectories = TestFSWithWatch.checkWatchedDirectories;
export import checkWatchedFilesDetailed = TestFSWithWatch.checkWatchedFilesDetailed;
export import checkWatchedDirectories = TestFSWithWatch.checkWatchedDirectories;
export import checkWatchedDirectoriesDetailed = TestFSWithWatch.checkWatchedDirectoriesDetailed;
import safeList = TestFSWithWatch.safeList;
export const customTypesMap = {
@@ -7294,7 +7296,6 @@ namespace ts.projectSystem {
const host = createServerHost(files);
const session = createSession(host);
const projectService = session.getProjectService();
debugger;
session.executeCommandSeq<protocol.OpenRequest>({
command: protocol.CommandTypes.Open,
arguments: {
@@ -7822,8 +7823,8 @@ namespace ts.projectSystem {
checkWatchedDirectories(host, emptyArray, /*recursive*/ true);
TestFSWithWatch.checkMultiMapKeyCount("watchedFiles", host.watchedFiles, expectedWatchedFiles);
TestFSWithWatch.checkMultiMapKeyCount("watchedDirectories", host.watchedDirectories, expectedWatchedDirectories);
checkWatchedFilesDetailed(host, expectedWatchedFiles);
checkWatchedDirectoriesDetailed(host, expectedWatchedDirectories, /*recursive*/ false);
checkProjectActualFiles(project, fileNames);
}
}
+103 -8
View File
@@ -141,7 +141,19 @@ namespace ts.projectSystem {
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const p = configuredProjectAt(projectService, 0);
checkProjectActualFiles(p, [file1.path, tsconfig.path]);
checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]);
const expectedWatchedFiles = createMap<number>();
expectedWatchedFiles.set(tsconfig.path, 1); // tsserver
expectedWatchedFiles.set(libFile.path, 1); // tsserver
expectedWatchedFiles.set(packageJson.path, 1); // typing installer
checkWatchedFilesDetailed(host, expectedWatchedFiles);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
const expectedWatchedDirectoriesRecursive = createMap<number>();
expectedWatchedDirectoriesRecursive.set("/a/b", 2); // TypingInstaller and wild card
expectedWatchedDirectoriesRecursive.set("/a/b/node_modules/@types", 1); // type root watch
checkWatchedDirectoriesDetailed(host, expectedWatchedDirectoriesRecursive, /*recursive*/ true);
installer.installAll(/*expectedCount*/ 1);
@@ -149,7 +161,9 @@ namespace ts.projectSystem {
host.checkTimeoutQueueLengthAndRun(2);
checkProjectActualFiles(p, [file1.path, jquery.path, tsconfig.path]);
// should not watch jquery
checkWatchedFiles(host, [tsconfig.path, libFile.path, packageJson.path, "/a/b/bower_components", "/a/b/node_modules"]);
checkWatchedFilesDetailed(host, expectedWatchedFiles);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
checkWatchedDirectoriesDetailed(host, expectedWatchedDirectoriesRecursive, /*recursive*/ true);
});
it("inferred project (typings installed)", () => {
@@ -827,7 +841,17 @@ namespace ts.projectSystem {
checkNumberOfProjects(projectService, { configuredProjects: 1 });
const p = configuredProjectAt(projectService, 0);
checkProjectActualFiles(p, [app.path, jsconfig.path]);
checkWatchedFiles(host, [jsconfig.path, "/bower_components", "/node_modules", libFile.path]);
const watchedFilesExpected = createMap<number>();
watchedFilesExpected.set(jsconfig.path, 1); // project files
watchedFilesExpected.set(libFile.path, 1); // project files
checkWatchedFilesDetailed(host, watchedFilesExpected);
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
const watchedRecursiveDirectoriesExpected = createMap<number>();
watchedRecursiveDirectoriesExpected.set("/", 2); // wild card + type installer
checkWatchedDirectoriesDetailed(host, watchedRecursiveDirectoriesExpected, /*recursive*/ true);
installer.installAll(/*expectedCount*/ 1);
@@ -999,14 +1023,14 @@ namespace ts.projectSystem {
proj.updateGraph();
assert.deepEqual(
proj.getCachedUnresolvedImportsPerFile_TestOnly().get(<Path>f1.path),
proj.cachedUnresolvedImportsPerFile.get(<Path>f1.path),
["foo", "foo", "foo", "@bar/router", "@bar/common", "@bar/common"]
);
installer.installAll(/*expectedCount*/ 1);
});
it("should recompute resolutions after typings are installed", () => {
it("cached unresolved typings are not recomputed if program structure did not change", () => {
const host = createServerHost([]);
const session = createSession(host);
const f = {
@@ -1029,7 +1053,7 @@ namespace ts.projectSystem {
const projectService = session.getProjectService();
checkNumberOfProjects(projectService, { inferredProjects: 1 });
const proj = projectService.inferredProjects[0];
const version1 = proj.getCachedUnresolvedImportsPerFile_TestOnly().getVersion();
const version1 = proj.lastCachedUnresolvedImportsList;
// make a change that should not affect the structure of the program
const changeRequest: server.protocol.ChangeRequest = {
@@ -1047,8 +1071,8 @@ namespace ts.projectSystem {
};
session.executeCommand(changeRequest);
host.checkTimeoutQueueLengthAndRun(2); // This enqueues the updategraph and refresh inferred projects
const version2 = proj.getCachedUnresolvedImportsPerFile_TestOnly().getVersion();
assert.notEqual(version1, version2, "set of unresolved imports should change");
const version2 = proj.lastCachedUnresolvedImportsList;
assert.strictEqual(version1, version2, "set of unresolved imports should change");
});
it("expired cache entry (inferred project, should install typings)", () => {
@@ -1621,4 +1645,75 @@ namespace ts.projectSystem {
assert.deepEqual(commands, expectedCommands, "commands");
});
});
describe("recomputing resolutions of unresolved imports", () => {
const globalTypingsCacheLocation = "/tmp";
const appPath = "/a/b/app.js" as Path;
const foooPath = "/a/b/node_modules/fooo/index.d.ts";
function verifyResolvedModuleOfFooo(project: server.Project) {
const foooResolution = project.getLanguageService().getProgram().getSourceFileByPath(appPath).resolvedModules.get("fooo");
assert.equal(foooResolution.resolvedFileName, foooPath);
return foooResolution;
}
function verifyUnresolvedImportResolutions(appContents: string, typingNames: string[], typingFiles: FileOrFolder[]) {
const app: FileOrFolder = {
path: appPath,
content: `${appContents}import * as x from "fooo";`
};
const fooo: FileOrFolder = {
path: foooPath,
content: `export var x: string;`
};
const host = createServerHost([app, fooo]);
const installer = new (class extends Installer {
constructor() {
super(host, { globalTypingsCacheLocation, typesRegistry: createTypesRegistry("foo") });
}
installWorker(_requestId: number, _args: string[], _cwd: string, cb: TI.RequestCompletedAction) {
executeCommand(this, host, typingNames, typingFiles, cb);
}
})();
const projectService = createProjectService(host, { typingsInstaller: installer });
projectService.openClientFile(app.path);
projectService.checkNumberOfProjects({ inferredProjects: 1 });
const proj = projectService.inferredProjects[0];
checkProjectActualFiles(proj, [app.path, fooo.path]);
const foooResolution1 = verifyResolvedModuleOfFooo(proj);
installer.installAll(/*expectedCount*/ 1);
host.checkTimeoutQueueLengthAndRun(2);
checkProjectActualFiles(proj, typingFiles.map(f => f.path).concat(app.path, fooo.path));
const foooResolution2 = verifyResolvedModuleOfFooo(proj);
assert.strictEqual(foooResolution1, foooResolution2);
}
it("correctly invalidate the resolutions with typing names", () => {
verifyUnresolvedImportResolutions('import * as a from "foo";', ["foo"], [{
path: `${globalTypingsCacheLocation}/node_modules/foo/index.d.ts`,
content: "export function a(): void;"
}]);
});
it("correctly invalidate the resolutions with typing names that are trimmed", () => {
const fooAA: FileOrFolder = {
path: `${globalTypingsCacheLocation}/node_modules/foo/a/a.d.ts`,
content: "export function a (): void;"
};
const fooAB: FileOrFolder = {
path: `${globalTypingsCacheLocation}/node_modules/foo/a/b.d.ts`,
content: "export function b (): void;"
};
const fooAC: FileOrFolder = {
path: `${globalTypingsCacheLocation}/node_modules/foo/a/c.d.ts`,
content: "export function c (): void;"
};
verifyUnresolvedImportResolutions(`
import * as a from "foo/a/a";
import * as b from "foo/a/b";
import * as c from "foo/a/c";
`, ["foo"], [fooAA, fooAB, fooAC]);
});
});
}
+9 -1
View File
@@ -179,10 +179,18 @@ interface Array<T> {}`
checkMapKeys("watchedFiles", host.watchedFiles, expectedFiles);
}
export function checkWatchedDirectories(host: TestServerHost, expectedDirectories: string[], recursive = false) {
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: Map<number>) {
checkMultiMapKeyCount("watchedFiles", host.watchedFiles, expectedFiles);
}
export function checkWatchedDirectories(host: TestServerHost, expectedDirectories: string[], recursive: boolean) {
checkMapKeys(`watchedDirectories${recursive ? " recursive" : ""}`, recursive ? host.watchedDirectoriesRecursive : host.watchedDirectories, expectedDirectories);
}
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: Map<number>, recursive: boolean) {
checkMultiMapKeyCount(`watchedDirectories${recursive ? " recursive" : ""}`, recursive ? host.watchedDirectoriesRecursive : host.watchedDirectories, expectedDirectories);
}
export function checkOutputContains(host: TestServerHost, expected: ReadonlyArray<string>) {
const mapExpected = arrayToSet(expected);
const mapSeen = createMap<true>();
+1 -8
View File
@@ -177,14 +177,7 @@ interface PromiseConstructor {
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<never>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
reject<T = never>(reason?: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
@@ -2388,15 +2388,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[编译完成。查看文件更改。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
@@ -3771,20 +3762,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found {0} errors.]]></Val>
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[找到 {0} 个错误。]]></Val>
<Val><![CDATA[找到 {0} 个错误。注意文件更改。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 1 error.]]></Val>
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[找到 1 个错误。]]></Val>
<Val><![CDATA[找到 1 个错误。注意文件更改。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
@@ -3894,6 +3894,15 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Generate_get_and_set_accessors_95046" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Generate 'get' and 'set' accessors]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[GET- und SET-Accessoren generieren]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Generates a sourcemap for each corresponding '.d.ts' file.]]></Val>
@@ -6003,6 +6012,9 @@
<Item ItemId=";Property_0_does_not_exist_on_type_1_Did_you_forget_to_use_await_2570" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Property '{0}' does not exist on type '{1}'. Did you forget to use 'await'?]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Die Eigenschaft "{0}" ist im Typ "{1}" nicht vorhanden. Haben Sie "await" nicht verwendet?]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
@@ -2388,15 +2388,6 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Compilation_complete_Watching_for_file_changes_6042" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Compilation complete. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Compilazione completata. Verranno individuate le modifiche ai file.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'.]]></Val>
@@ -3771,20 +3762,20 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_0_errors_6194" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Found_0_errors_Watching_for_file_changes_6194" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found {0} errors.]]></Val>
<Val><![CDATA[Found {0} errors. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Sono stati trovati {0} errori.]]></Val>
<Val><![CDATA[Sono stati trovati {0} errori. Verranno individuate le modifiche ai file.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Found_1_error_6193" ItemType="0" PsrId="306" Leaf="true">
<Item ItemId=";Found_1_error_Watching_for_file_changes_6193" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Found 1 error.]]></Val>
<Val><![CDATA[Found 1 error. Watching for file changes.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[È stato trovato 1 errore.]]></Val>
<Val><![CDATA[È stato trovato 1 errore. Verranno individuate le modifiche ai file.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
+7 -6
View File
@@ -312,7 +312,8 @@ namespace ts.server {
export class ProjectService {
public readonly typingsCache: TypingsCache;
/*@internal*/
readonly typingsCache: TypingsCache;
private readonly documentRegistry: DocumentRegistry;
@@ -527,13 +528,13 @@ namespace ts.server {
}
switch (response.kind) {
case ActionSet:
project.resolutionCache.clear();
this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings);
// Update the typing files and update the project
project.updateTypingFiles(this.typingsCache.updateTypingsForProject(response.projectName, response.compilerOptions, response.typeAcquisition, response.unresolvedImports, response.typings));
break;
case ActionInvalidate:
project.resolutionCache.clear();
this.typingsCache.deleteTypingsForProject(response.projectName);
break;
// Do not clear resolution cache, there was changes detected in typings, so enque typing request and let it get us correct results
this.typingsCache.enqueueInstallTypingsForProject(project, project.lastCachedUnresolvedImportsList, /*forceRefresh*/ true);
return;
}
this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
}
+61 -74
View File
@@ -55,34 +55,6 @@ namespace ts.server {
projectErrors: ReadonlyArray<Diagnostic>;
}
export class UnresolvedImportsMap {
readonly perFileMap = createMap<ReadonlyArray<string>>();
private version = 0;
public clear() {
this.perFileMap.clear();
this.version = 0;
}
public getVersion() {
return this.version;
}
public remove(path: Path) {
this.perFileMap.delete(path);
this.version++;
}
public get(path: Path) {
return this.perFileMap.get(path);
}
public set(path: Path, value: ReadonlyArray<string>) {
this.perFileMap.set(path, value);
this.version++;
}
}
export interface PluginCreateInfo {
project: Project;
languageService: LanguageService;
@@ -116,8 +88,18 @@ namespace ts.server {
private missingFilesMap: Map<FileWatcher>;
private plugins: PluginModule[] = [];
private cachedUnresolvedImportsPerFile = new UnresolvedImportsMap();
private lastCachedUnresolvedImportsList: SortedReadonlyArray<string>;
/*@internal*/
/**
* This is map from files to unresolved imports in it
* Maop does not contain entries for files that do not have unresolved imports
* This helps in containing the set of files to invalidate
*/
cachedUnresolvedImportsPerFile = createMap<ReadonlyArray<string>>();
/*@internal*/
lastCachedUnresolvedImportsList: SortedReadonlyArray<string>;
/*@internal*/
private hasAddedorRemovedFiles = false;
private lastFileExceededProgramSize: string | undefined;
@@ -149,10 +131,10 @@ namespace ts.server {
*/
private lastReportedVersion = 0;
/**
* Current project structure version.
* Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
* This property is changed in 'updateGraph' based on the set of files in program
*/
private projectStructureVersion = 0;
private projectProgramVersion = 0;
/**
* Current version of the project state. It is changed when:
* - new root file was added/removed
@@ -167,7 +149,8 @@ namespace ts.server {
/*@internal*/
hasChangedAutomaticTypeDirectiveNames = false;
private typingFiles: SortedReadonlyArray<string>;
/*@internal*/
typingFiles: SortedReadonlyArray<string> = emptyArray;
private readonly cancellationToken: ThrottledCancellationToken;
@@ -181,10 +164,6 @@ namespace ts.server {
return hasOneOrMoreJsAndNoTsFiles(this);
}
public getCachedUnresolvedImportsPerFile_TestOnly() {
return this.cachedUnresolvedImportsPerFile;
}
public static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} {
const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
log(`Loading ${moduleName} from ${initialDir} (resolved to ${resolvedPath})`);
@@ -742,7 +721,7 @@ namespace ts.server {
else {
this.resolutionCache.invalidateResolutionOfFile(info.path);
}
this.cachedUnresolvedImportsPerFile.remove(info.path);
this.cachedUnresolvedImportsPerFile.delete(info.path);
if (detachFromProject) {
info.detachFromProject(this);
@@ -763,16 +742,13 @@ namespace ts.server {
}
/* @internal */
private extractUnresolvedImportsFromSourceFile(file: SourceFile, result: Push<string>, ambientModules: string[]) {
private extractUnresolvedImportsFromSourceFile(file: SourceFile, ambientModules: string[]): ReadonlyArray<string> {
const cached = this.cachedUnresolvedImportsPerFile.get(file.path);
if (cached) {
// found cached result - use it and return
for (const f of cached) {
result.push(f);
}
return;
// found cached result, return
return cached;
}
let unresolvedImports: string[];
let unresolvedImports: string[] | undefined;
if (file.resolvedModules) {
file.resolvedModules.forEach((resolvedModule, name) => {
// pick unresolved non-relative names
@@ -788,17 +764,23 @@ namespace ts.server {
trimmed = trimmed.substr(0, i);
}
(unresolvedImports || (unresolvedImports = [])).push(trimmed);
result.push(trimmed);
}
});
}
this.cachedUnresolvedImportsPerFile.set(file.path, unresolvedImports || emptyArray);
return unresolvedImports || emptyArray;
function isAmbientlyDeclaredModule(name: string) {
return ambientModules.some(m => m === name);
}
}
/* @internal */
onFileAddedOrRemoved() {
this.hasAddedorRemovedFiles = true;
}
/**
* Updates set of files that contribute to this project
* @returns: true if set of files in the project stays the same and false - otherwise.
@@ -806,13 +788,15 @@ namespace ts.server {
updateGraph(): boolean {
this.resolutionCache.startRecordingFilesWithChangedResolutions();
let hasChanges = this.updateGraphWorker();
const hasNewProgram = this.updateGraphWorker();
const hasAddedorRemovedFiles = this.hasAddedorRemovedFiles;
this.hasAddedorRemovedFiles = false;
const changedFiles: ReadonlyArray<Path> = this.resolutionCache.finishRecordingFilesWithChangedResolutions() || emptyArray;
for (const file of changedFiles) {
// delete cached information for changed files
this.cachedUnresolvedImportsPerFile.remove(file);
this.cachedUnresolvedImportsPerFile.delete(file);
}
// update builder only if language service is enabled
@@ -824,30 +808,35 @@ namespace ts.server {
// 3. new files were added/removed, but compilation settings stays the same - collect unresolved imports for all new/modified files
// (can reuse cached imports for files that were not changed)
// 4. compilation settings were changed in the way that might affect module resolution - drop all caches and collect all data from the scratch
if (hasChanges || changedFiles.length) {
const result: string[] = [];
if (hasNewProgram || changedFiles.length) {
let result: string[] | undefined;
const ambientModules = this.program.getTypeChecker().getAmbientModules().map(mod => stripQuotes(mod.getName()));
for (const sourceFile of this.program.getSourceFiles()) {
this.extractUnresolvedImportsFromSourceFile(sourceFile, result, ambientModules);
const unResolved = this.extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules);
if (unResolved !== emptyArray) {
(result || (result = [])).push(...unResolved);
}
}
this.lastCachedUnresolvedImportsList = toDeduplicatedSortedArray(result);
this.lastCachedUnresolvedImportsList = result ? toDeduplicatedSortedArray(result) : emptyArray;
}
const cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasChanges);
if (!arrayIsEqualTo(this.typingFiles, cachedTypings)) {
this.typingFiles = cachedTypings;
this.markAsDirty();
hasChanges = this.updateGraphWorker() || hasChanges;
}
this.projectService.typingsCache.enqueueInstallTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasAddedorRemovedFiles);
}
else {
this.lastCachedUnresolvedImportsList = undefined;
}
if (hasChanges) {
this.projectStructureVersion++;
if (hasNewProgram) {
this.projectProgramVersion++;
}
return !hasChanges;
return !hasNewProgram;
}
/*@internal*/
updateTypingFiles(typingFiles: SortedReadonlyArray<string>) {
this.typingFiles = typingFiles;
// Invalidate files with unresolved imports
this.resolutionCache.setFilesWithInvalidatedNonRelativeUnresolvedImports(this.cachedUnresolvedImportsPerFile);
}
/* @internal */
@@ -876,9 +865,9 @@ namespace ts.server {
// bump up the version if
// - oldProgram is not set - this is a first time updateGraph is called
// - newProgram is different from the old program and structure of the old program was not reused.
const hasChanges = this.program && (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely)));
const hasNewProgram = this.program && (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & StructureIsReused.Completely)));
this.hasChangedAutomaticTypeDirectiveNames = false;
if (hasChanges) {
if (hasNewProgram) {
if (oldProgram) {
for (const f of oldProgram.getSourceFiles()) {
if (this.program.getSourceFileByPath(f.path)) {
@@ -916,8 +905,8 @@ namespace ts.server {
removed => this.detachScriptInfoFromProject(removed)
);
const elapsed = timestamp() - start;
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasChanges} Elapsed: ${elapsed}ms`);
return hasChanges;
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram} Elapsed: ${elapsed}ms`);
return hasNewProgram;
}
private detachScriptInfoFromProject(uncheckedFileName: string) {
@@ -985,15 +974,13 @@ namespace ts.server {
setCompilerOptions(compilerOptions: CompilerOptions) {
if (compilerOptions) {
compilerOptions.allowNonTsExtensions = true;
if (changesAffectModuleResolution(this.compilerOptions, compilerOptions)) {
// reset cached unresolved imports if changes in compiler options affected module resolution
this.cachedUnresolvedImportsPerFile.clear();
this.lastCachedUnresolvedImportsList = undefined;
}
const oldOptions = this.compilerOptions;
this.compilerOptions = compilerOptions;
this.setInternalCompilerOptionsForEmittingJsFiles();
if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
// reset cached unresolved imports if changes in compiler options affected module resolution
this.cachedUnresolvedImportsPerFile.clear();
this.lastCachedUnresolvedImportsList = undefined;
this.resolutionCache.clear();
}
this.markAsDirty();
@@ -1006,7 +993,7 @@ namespace ts.server {
const info: protocol.ProjectVersionInfo = {
projectName: this.getProjectName(),
version: this.projectStructureVersion,
version: this.projectProgramVersion,
isInferred: this.projectKind === ProjectKind.Inferred,
options: this.getCompilationSettings(),
languageServiceDisabled: !this.languageServiceEnabled,
@@ -1017,7 +1004,7 @@ namespace ts.server {
// check if requested version is the same that we have reported last time
if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) {
// if current structure version is the same - return info without any changes
if (this.projectStructureVersion === this.lastReportedVersion && !updatedFileNames) {
if (this.projectProgramVersion === this.lastReportedVersion && !updatedFileNames) {
return { info, projectErrors: this.getGlobalProjectErrors() };
}
// compute and return the difference
@@ -1040,7 +1027,7 @@ namespace ts.server {
}
});
this.lastReportedFileNames = currentFiles;
this.lastReportedVersion = this.projectStructureVersion;
this.lastReportedVersion = this.projectProgramVersion;
return { info, changes: { added, removed, updated }, projectErrors: this.getGlobalProjectErrors() };
}
else {
@@ -1049,7 +1036,7 @@ namespace ts.server {
const externalFiles = this.getExternalFiles().map(f => toNormalizedPath(f));
const allFiles = projectFileNames.concat(externalFiles);
this.lastReportedFileNames = arrayToSet(allFiles);
this.lastReportedVersion = this.projectStructureVersion;
this.lastReportedVersion = this.projectProgramVersion;
return { info, files: allFiles, projectErrors: this.getGlobalProjectErrors() };
}
}
+7 -1
View File
@@ -304,6 +304,7 @@ namespace ts.server {
const isNew = !this.isAttached(project);
if (isNew) {
this.containingProjects.push(project);
project.onFileAddedOrRemoved();
if (!project.getCompilerOptions().preserveSymlinks) {
this.ensureRealPath();
}
@@ -328,19 +329,24 @@ namespace ts.server {
return;
case 1:
if (this.containingProjects[0] === project) {
project.onFileAddedOrRemoved();
this.containingProjects.pop();
}
break;
case 2:
if (this.containingProjects[0] === project) {
project.onFileAddedOrRemoved();
this.containingProjects[0] = this.containingProjects.pop();
}
else if (this.containingProjects[1] === project) {
project.onFileAddedOrRemoved();
this.containingProjects.pop();
}
break;
default:
unorderedRemoveItem(this.containingProjects, project);
if (unorderedRemoveItem(this.containingProjects, project)) {
project.onFileAddedOrRemoved();
}
break;
}
}
+2 -1
View File
@@ -634,7 +634,8 @@ namespace ts.server {
code: d.code,
source: d.source,
startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)
endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length),
reportsUnnecessary: d.reportsUnnecessary
});
}
+2
View File
@@ -119,8 +119,10 @@ declare namespace ts.server {
/* @internal */
export interface InstallTypingHost extends JsTyping.TypingResolutionHost {
useCaseSensitiveFileNames: boolean;
writeFile(path: string, content: string): void;
createDirectory(path: string): void;
watchFile?(path: string, callback: FileWatcherCallback, pollingInterval?: number): FileWatcher;
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
}
}
+8 -11
View File
@@ -24,7 +24,7 @@ namespace ts.server {
globalTypingsCacheLocation: undefined
};
class TypingsCacheEntry {
interface TypingsCacheEntry {
readonly typeAcquisition: TypeAcquisition;
readonly compilerOptions: CompilerOptions;
readonly typings: SortedReadonlyArray<string>;
@@ -80,6 +80,7 @@ namespace ts.server {
return !arrayIsEqualTo(imports1, imports2);
}
/*@internal*/
export class TypingsCache {
private readonly perProjectCache: Map<TypingsCacheEntry> = createMap<TypingsCacheEntry>();
@@ -94,15 +95,14 @@ namespace ts.server {
return this.installer.installPackage(options);
}
getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray<string>, forceRefresh: boolean): SortedReadonlyArray<string> {
enqueueInstallTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray<string>, forceRefresh: boolean) {
const typeAcquisition = project.getTypeAcquisition();
if (!typeAcquisition || !typeAcquisition.enable) {
return <any>emptyArray;
return;
}
const entry = this.perProjectCache.get(project.getProjectName());
const result: SortedReadonlyArray<string> = entry ? entry.typings : <any>emptyArray;
if (forceRefresh ||
!entry ||
typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) ||
@@ -113,28 +113,25 @@ namespace ts.server {
this.perProjectCache.set(project.getProjectName(), {
compilerOptions: project.getCompilationSettings(),
typeAcquisition,
typings: result,
typings: entry ? entry.typings : emptyArray,
unresolvedImports,
poisoned: true
});
// something has been changed, issue a request to update typings
this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
}
return result;
}
updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, newTypings: string[]) {
const typings = toSortedArray(newTypings);
this.perProjectCache.set(projectName, {
compilerOptions,
typeAcquisition,
typings: toSortedArray(newTypings),
typings,
unresolvedImports,
poisoned: false
});
}
deleteTypingsForProject(projectName: string) {
this.perProjectCache.delete(projectName);
return !typeAcquisition || !typeAcquisition.enable ? emptyArray : typings;
}
onProjectClosed(project: Project) {
+113 -32
View File
@@ -64,13 +64,31 @@ namespace ts.server.typingsInstaller {
onRequestCompleted: RequestCompletedAction;
}
function isPackageOrBowerJson(fileName: string) {
const base = getBaseFileName(fileName);
return base === "package.json" || base === "bower.json";
}
function getDirectoryExcludingNodeModulesOrBowerComponents(f: string) {
const indexOfNodeModules = f.indexOf("/node_modules/");
const indexOfBowerComponents = f.indexOf("/bower_components/");
const subStrLength = indexOfNodeModules === -1 || indexOfBowerComponents === -1 ?
Math.max(indexOfNodeModules, indexOfBowerComponents) :
Math.min(indexOfNodeModules, indexOfBowerComponents);
return subStrLength === -1 ? f : f.substr(0, subStrLength);
}
type ProjectWatchers = Map<FileWatcher> & { isInvoked?: boolean; };
export abstract class TypingsInstaller {
private readonly packageNameToTypingLocation: Map<JsTyping.CachedTyping> = createMap<JsTyping.CachedTyping>();
private readonly missingTypingsSet: Map<true> = createMap<true>();
private readonly knownCachesSet: Map<true> = createMap<true>();
private readonly projectWatchers = createMap<Map<FileWatcher>>();
private readonly projectWatchers = createMap<ProjectWatchers>();
private safeList: JsTyping.SafeList | undefined;
readonly pendingRunRequests: PendingRequest[] = [];
private readonly toCanonicalFileName: GetCanonicalFileName;
private readonly globalCacheCanonicalPackageJsonPath: string;
private installRunCount = 1;
private inFlightRequestCount = 0;
@@ -84,6 +102,8 @@ namespace ts.server.typingsInstaller {
private readonly typesMapLocation: Path,
private readonly throttleLimit: number,
protected readonly log = nullLog) {
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
this.globalCacheCanonicalPackageJsonPath = combinePaths(this.toCanonicalFileName(globalCachePath), "package.json");
if (this.log.isEnabled()) {
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation}`);
}
@@ -145,7 +165,7 @@ namespace ts.server.typingsInstaller {
}
// start watching files
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch, req.projectRootPath);
// install typings
if (discoverTypingsResult.newTypingNames.length) {
@@ -365,7 +385,7 @@ namespace ts.server.typingsInstaller {
}
}
private watchFiles(projectName: string, files: string[]) {
private watchFiles(projectName: string, files: string[], projectRootPath: Path) {
if (!files.length) {
// shut down existing watchers
this.closeWatchers(projectName);
@@ -373,43 +393,104 @@ namespace ts.server.typingsInstaller {
}
let watchers = this.projectWatchers.get(projectName);
const toRemove = createMap<FileWatcher>();
if (!watchers) {
watchers = createMap();
this.projectWatchers.set(projectName, watchers);
}
else {
copyEntries(watchers, toRemove);
}
// handler should be invoked once for the entire set of files since it will trigger full rediscovery of typings
let isInvoked = false;
watchers.isInvoked = false;
const isLoggingEnabled = this.log.isEnabled();
mutateMap(
watchers,
arrayToSet(files),
{
// Watch the missing files
createNewValue: file => {
if (isLoggingEnabled) {
this.log.writeLine(`FileWatcher:: Added:: WatchInfo: ${file}`);
}
const watcher = this.installTypingHost.watchFile(file, (f, eventKind) => {
if (isLoggingEnabled) {
this.log.writeLine(`FileWatcher:: Triggered with ${f} eventKind: ${FileWatcherEventKind[eventKind]}:: WatchInfo: ${file}:: handler is already invoked '${isInvoked}'`);
}
if (!isInvoked) {
this.sendResponse({ projectName, kind: ActionInvalidate });
isInvoked = true;
}
}, /*pollingInterval*/ 2000);
return isLoggingEnabled ? {
close: () => {
this.log.writeLine(`FileWatcher:: Closed:: WatchInfo: ${file}`);
}
} : watcher;
},
// Files that are no longer missing (e.g. because they are no longer required)
// should no longer be watched.
onDeleteValue: closeFileWatcher
const createProjectWatcher = (path: string, createWatch: (path: string) => FileWatcher) => {
toRemove.delete(path);
if (watchers.has(path)) {
return;
}
);
watchers.set(path, createWatch(path));
};
const createProjectFileWatcher = (file: string): FileWatcher => {
if (isLoggingEnabled) {
this.log.writeLine(`FileWatcher:: Added:: WatchInfo: ${file}`);
}
const watcher = this.installTypingHost.watchFile(file, (f, eventKind) => {
if (isLoggingEnabled) {
this.log.writeLine(`FileWatcher:: Triggered with ${f} eventKind: ${FileWatcherEventKind[eventKind]}:: WatchInfo: ${file}:: handler is already invoked '${watchers.isInvoked}'`);
}
if (!watchers.isInvoked) {
watchers.isInvoked = true;
this.sendResponse({ projectName, kind: ActionInvalidate });
}
}, /*pollingInterval*/ 2000);
return isLoggingEnabled ? {
close: () => {
this.log.writeLine(`FileWatcher:: Closed:: WatchInfo: ${file}`);
watcher.close();
}
} : watcher;
};
const createProjectDirectoryWatcher = (dir: string): FileWatcher => {
if (isLoggingEnabled) {
this.log.writeLine(`DirectoryWatcher:: Added:: WatchInfo: ${dir} recursive`);
}
const watcher = this.installTypingHost.watchDirectory(dir, f => {
if (isLoggingEnabled) {
this.log.writeLine(`DirectoryWatcher:: Triggered with ${f} :: WatchInfo: ${dir} recursive :: handler is already invoked '${watchers.isInvoked}'`);
}
if (watchers.isInvoked) {
return;
}
f = this.toCanonicalFileName(f);
if (f !== this.globalCacheCanonicalPackageJsonPath && isPackageOrBowerJson(f)) {
watchers.isInvoked = true;
this.sendResponse({ projectName, kind: ActionInvalidate });
}
}, /*recursive*/ true);
return isLoggingEnabled ? {
close: () => {
this.log.writeLine(`DirectoryWatcher:: Closed:: WatchInfo: ${dir} recursive`);
watcher.close();
}
} : watcher;
};
// Create watches from list of files
for (const file of files) {
const filePath = this.toCanonicalFileName(file);
if (isPackageOrBowerJson(filePath)) {
// package.json or bower.json exists, watch the file to detect changes and update typings
createProjectWatcher(filePath, createProjectFileWatcher);
continue;
}
// path in projectRoot, watch project root
if (containsPath(projectRootPath, filePath, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
createProjectWatcher(projectRootPath, createProjectDirectoryWatcher);
continue;
}
// path in global cache, watch global cache
if (containsPath(this.globalCachePath, filePath, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
createProjectWatcher(this.globalCachePath, createProjectDirectoryWatcher);
continue;
}
// Get path without node_modules and bower_components
createProjectWatcher(getDirectoryExcludingNodeModulesOrBowerComponents(getDirectoryPath(filePath)), createProjectDirectoryWatcher);
}
// Remove unused watches
toRemove.forEach((watch, path) => {
watch.close();
watchers.delete(path);
});
}
private createSetTypings(request: DiscoverTypings, typings: string[]): SetTypings {
@@ -1,35 +1,38 @@
/* @internal */
namespace ts.codefix {
const fixId = "forgottenThisPropertyAccess";
const errorCodes = [Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code];
const didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
const errorCodes = [
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
didYouMeanStaticMemberCode,
];
registerCodeFix({
errorCodes,
getCodeActions(context) {
const { sourceFile } = context;
const token = getNode(sourceFile, context.span.start);
if (!token) {
const info = getInfo(sourceFile, context.span.start, context.errorCode);
if (!info) {
return undefined;
}
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, token));
return [createCodeFixAction(fixId, changes, Diagnostics.Add_this_to_unresolved_variable, fixId, Diagnostics.Add_this_to_all_unresolved_variables_matching_a_member_name)];
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, info));
return [createCodeFixAction(fixId, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => {
doChange(changes, context.sourceFile, getNode(diag.file, diag.start!));
doChange(changes, context.sourceFile, getInfo(diag.file, diag.start!, diag.code));
}),
});
function getNode(sourceFile: SourceFile, pos: number): Identifier | undefined {
interface Info { readonly node: Identifier; readonly className: string | undefined; }
function getInfo(sourceFile: SourceFile, pos: number, diagCode: number): Info | undefined {
const node = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false);
return isIdentifier(node) ? node : undefined;
if (!isIdentifier(node)) return undefined;
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : undefined };
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, token: Identifier | undefined): void {
if (!token) {
return;
}
function doChange(changes: textChanges.ChangeTracker, sourceFile: SourceFile, { node, className }: Info): void {
// TODO (https://github.com/Microsoft/TypeScript/issues/21246): use shared helper
suppressLeadingAndTrailingTrivia(token);
changes.replaceNode(sourceFile, token, createPropertyAccess(createThis(), token));
suppressLeadingAndTrailingTrivia(node);
changes.replaceNode(sourceFile, node, createPropertyAccess(className ? createIdentifier(className) : createThis(), node));
}
}
+46 -77
View File
@@ -130,8 +130,7 @@ namespace ts.FindAllReferences {
const { node, name, kind, displayParts } = info;
const sourceFile = node.getSourceFile();
const textSpan = getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile);
return { containerKind: ScriptElementKind.unknown, containerName: "", fileName: sourceFile.fileName, kind, name, textSpan, displayParts };
return { containerKind: ScriptElementKind.unknown, containerName: "", fileName: sourceFile.fileName, kind, name, textSpan: getTextSpan(isComputedPropertyName(node) ? node.expression : node, sourceFile), displayParts };
}
function getDefinitionKindAndDisplayParts(symbol: Symbol, checker: TypeChecker, node: Node): { displayParts: SymbolDisplayPart[], kind: ScriptElementKind } {
@@ -148,21 +147,23 @@ namespace ts.FindAllReferences {
}
const { node, isInString } = entry;
const sourceFile = node.getSourceFile();
return {
fileName: node.getSourceFile().fileName,
textSpan: getTextSpan(node),
fileName: sourceFile.fileName,
textSpan: getTextSpan(node, sourceFile),
isWriteAccess: isWriteAccessForReference(node),
isDefinition: node.kind === SyntaxKind.DefaultKeyword
|| isAnyDeclarationName(node)
|| isLiteralComputedPropertyDeclarationName(node),
isInString
isInString,
};
}
function toImplementationLocation(entry: Entry, checker: TypeChecker): ImplementationLocation {
if (entry.type === "node") {
const { node } = entry;
return { textSpan: getTextSpan(node), fileName: node.getSourceFile().fileName, ...implementationKindDisplayParts(node, checker) };
const sourceFile = node.getSourceFile();
return { textSpan: getTextSpan(node, sourceFile), fileName: sourceFile.fileName, ...implementationKindDisplayParts(node, checker) };
}
else {
const { textSpan, fileName } = entry;
@@ -199,17 +200,17 @@ namespace ts.FindAllReferences {
}
const { node, isInString } = entry;
const fileName = entry.node.getSourceFile().fileName;
const sourceFile = node.getSourceFile();
const writeAccess = isWriteAccessForReference(node);
const span: HighlightSpan = {
textSpan: getTextSpan(node),
textSpan: getTextSpan(node, sourceFile),
kind: writeAccess ? HighlightSpanKind.writtenReference : HighlightSpanKind.reference,
isInString
};
return { fileName, span };
return { fileName: sourceFile.fileName, span };
}
function getTextSpan(node: Node, sourceFile?: SourceFile): TextSpan {
function getTextSpan(node: Node, sourceFile: SourceFile): TextSpan {
let start = node.getStart(sourceFile);
let end = node.getEnd();
if (node.kind === SyntaxKind.StringLiteral) {
@@ -554,7 +555,10 @@ namespace ts.FindAllReferences.Core {
if (singleReferences.length) {
const addRef = state.referenceAdder(exportSymbol);
for (const singleRef of singleReferences) {
addRef(singleRef);
// At `default` in `import { default as x }` or `export { default as x }`, do add a reference, but do not rename.
if (!(state.options.isForRename && (isExportSpecifier(singleRef.parent) || isImportSpecifier(singleRef.parent)) && singleRef.escapedText === InternalSymbolName.Default)) {
addRef(singleRef);
}
}
}
@@ -886,7 +890,10 @@ namespace ts.FindAllReferences.Core {
}
if (!propertyName) {
addRef();
// Don't rename at `export { default } from "m";`. (but do continue to search for imports of the re-export)
if (!(state.options.isForRename && name.escapedText === InternalSymbolName.Default)) {
addRef();
}
}
else if (referenceLocation === propertyName) {
// For `export { foo as bar } from "baz"`, "`foo`" will be added from the singleReferences for import searches of the original export.
@@ -1030,10 +1037,6 @@ namespace ts.FindAllReferences.Core {
}
}
function getPropertyAccessExpressionFromRightHandSide(node: Node): PropertyAccessExpression {
return isRightSideOfPropertyAccess(node) && <PropertyAccessExpression>node.parent;
}
/**
* `classSymbol` is the class where the constructor was defined.
* Reference the constructor and all calls to `new this()`.
@@ -1105,69 +1108,37 @@ namespace ts.FindAllReferences.Core {
}
// If we got a type reference, try and see if the reference applies to any expressions that can implement an interface
const containingTypeReference = getContainingTypeReference(refNode);
if (containingTypeReference && state.markSeenContainingTypeReference(containingTypeReference)) {
const parent = containingTypeReference.parent;
if (hasType(parent) && parent.type === containingTypeReference && hasInitializer(parent) && isImplementationExpression(parent.initializer)) {
addReference(parent.initializer);
// Find the first node whose parent isn't a type node -- i.e., the highest type node.
const typeNode = findAncestor(refNode, a => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
const typeHavingNode = typeNode.parent;
if (hasType(typeHavingNode) && typeHavingNode.type === typeNode && state.markSeenContainingTypeReference(typeHavingNode)) {
if (hasInitializer(typeHavingNode)) {
addIfImplementation(typeHavingNode.initializer);
}
else if (isFunctionLike(parent) && parent.type === containingTypeReference && (parent as FunctionLikeDeclaration).body) {
const body = (parent as FunctionLikeDeclaration).body;
else if (isFunctionLike(typeHavingNode) && (typeHavingNode as FunctionLikeDeclaration).body) {
const body = (typeHavingNode as FunctionLikeDeclaration).body;
if (body.kind === SyntaxKind.Block) {
forEachReturnStatement(<Block>body, returnStatement => {
if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) {
addReference(returnStatement.expression);
}
if (returnStatement.expression) addIfImplementation(returnStatement.expression);
});
}
else if (isImplementationExpression(body)) {
addReference(body);
else {
addIfImplementation(body);
}
}
else if (isAssertionExpression(parent) && isImplementationExpression(parent.expression)) {
addReference(parent.expression);
else if (isAssertionExpression(typeHavingNode)) {
addIfImplementation(typeHavingNode.expression);
}
}
function addIfImplementation(e: Expression): void {
if (isImplementationExpression(e)) addReference(e);
}
}
function getSymbolsForClassAndInterfaceComponents(type: UnionOrIntersectionType, result: Symbol[] = []): Symbol[] {
for (const componentType of type.types) {
if (componentType.symbol && componentType.symbol.getFlags() & (SymbolFlags.Class | SymbolFlags.Interface)) {
result.push(componentType.symbol);
}
if (componentType.isUnionOrIntersection()) {
getSymbolsForClassAndInterfaceComponents(componentType, result);
}
}
return result;
}
function getContainingTypeReference(node: Node): Node {
let topLevelTypeReference: Node;
while (node) {
if (isTypeNode(node)) {
topLevelTypeReference = node;
}
node = node.parent;
}
return topLevelTypeReference;
}
function getContainingClassIfInHeritageClause(node: Node): ClassLikeDeclaration {
if (node && node.parent) {
if (node.kind === SyntaxKind.ExpressionWithTypeArguments
&& node.parent.kind === SyntaxKind.HeritageClause
&& isClassLike(node.parent.parent)) {
return node.parent.parent;
}
else if (node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.PropertyAccessExpression) {
return getContainingClassIfInHeritageClause(node.parent);
}
}
return undefined;
function getContainingClassIfInHeritageClause(node: Node): ClassLikeDeclaration | InterfaceDeclaration {
return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingClassIfInHeritageClause(node.parent)
: isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, isClassLike) : undefined;
}
/**
@@ -1462,7 +1433,7 @@ namespace ts.FindAllReferences.Core {
? rootSymbol && !(getCheckFlags(sym) & CheckFlags.Synthetic) ? rootSymbol : sym
: undefined,
/*allowBaseTypes*/ rootSymbol =>
!(search.parents && !some(search.parents, parent => explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker))));
!(search.parents && !search.parents.some(parent => explicitlyInheritsFrom(rootSymbol.parent, parent, state.inheritsFromCache, checker))));
}
/** Gets all symbols for one property. Does not get symbols for every property. */
@@ -1549,13 +1520,11 @@ namespace ts.FindAllReferences.Core {
* symbol may have a different parent symbol if the local type's symbol does not declare the property
* being accessed (i.e. it is declared in some parent class or interface)
*/
function getParentSymbolsOfPropertyAccess(location: Node, symbol: Symbol, checker: TypeChecker): Symbol[] | undefined {
const propertyAccessExpression = getPropertyAccessExpressionFromRightHandSide(location);
const localParentType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression);
return localParentType && localParentType.symbol && localParentType.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) && localParentType.symbol !== symbol.parent
? [localParentType.symbol]
: localParentType && localParentType.isUnionOrIntersection()
? getSymbolsForClassAndInterfaceComponents(localParentType)
: undefined;
function getParentSymbolsOfPropertyAccess(location: Node, symbol: Symbol, checker: TypeChecker): ReadonlyArray<Symbol> | undefined {
const propertyAccessExpression = isRightSideOfPropertyAccess(location) ? <PropertyAccessExpression>location.parent : undefined;
const lhsType = propertyAccessExpression && checker.getTypeAtLocation(propertyAccessExpression.expression);
const res = mapDefined(lhsType && (lhsType.isUnionOrIntersection() ? lhsType.types : lhsType.symbol === symbol.parent ? undefined : [lhsType]), t =>
t.symbol && t.symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? t.symbol : undefined);
return res.length === 0 ? undefined : res;
}
}
+9 -3
View File
@@ -33,7 +33,7 @@ namespace ts.FindAllReferences {
interface AmbientModuleDeclaration extends ModuleDeclaration { body?: ModuleBlock; }
type SourceFileLike = SourceFile | AmbientModuleDeclaration;
// Identifier for the case of `const x = require("y")`.
type Importer = AnyImportOrReExport | Identifier;
type Importer = AnyImportOrReExport | ImportTypeNode | Identifier;
type ImporterOrCallExpression = Importer | CallExpression;
/** Returns import statements that directly reference the exporting module, and a list of files that may access the module through a namespace. */
@@ -215,6 +215,10 @@ namespace ts.FindAllReferences {
return;
}
if (decl.kind === SyntaxKind.ImportType) {
return;
}
// Ignore if there's a grammar error
if (decl.moduleSpecifier.kind !== SyntaxKind.StringLiteral) {
return;
@@ -250,7 +254,7 @@ namespace ts.FindAllReferences {
}
// 'default' might be accessed as a named import `{ default as foo }`.
if (!isForRename && exportKind === ExportKind.Default) {
if (exportKind === ExportKind.Default) {
searchForNamedImport(namedBindings as NamedImports | undefined);
}
}
@@ -282,7 +286,9 @@ namespace ts.FindAllReferences {
if (propertyName) {
// This is `import { foo as bar } from "./a"` or `export { foo as bar } from "./a"`. `foo` isn't a local in the file, so just add it as a single reference.
singleReferences.push(propertyName);
if (!isForRename) { // If renaming `foo`, don't touch `bar`, just `foo`.
// If renaming `{ foo as bar }`, don't touch `bar`, just `foo`.
// But do rename `foo` in ` { default as foo }` if that's the original export name.
if (!isForRename || name.escapedText === exportSymbol.escapedName) {
// Search locally for `bar`.
addSearch(name, checker.getSymbolAtLocation(name));
}
+14
View File
@@ -26,6 +26,15 @@ namespace ts.SymbolDisplay {
}
function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker: TypeChecker, symbol: Symbol, location: Node): ScriptElementKind {
const roots = typeChecker.getRootSymbols(symbol);
// If this is a method from a mapped type, leave as a method so long as it still has a call signature.
if (roots.length === 1
&& first(roots).flags & SymbolFlags.Method
// Ensure the mapped version is still a method, as opposed to `{ [K in keyof I]: number }`.
&& typeChecker.getTypeOfSymbolAtLocation(symbol, location).getNonNullableType().getCallSignatures().length !== 0) {
return ScriptElementKind.memberFunctionElement;
}
if (typeChecker.isUndefinedSymbol(symbol)) {
return ScriptElementKind.variableElement;
}
@@ -125,6 +134,7 @@ namespace ts.SymbolDisplay {
let type: Type;
let printer: Printer;
let documentationFromAlias: SymbolDisplayPart[];
let tagsFromAlias: JSDocTagInfo[];
// Class at constructor site need to be shown as constructor apart from property,method, vars
if (symbolKind !== ScriptElementKind.unknown || symbolFlags & SymbolFlags.Class || symbolFlags & SymbolFlags.Alias) {
@@ -387,6 +397,7 @@ namespace ts.SymbolDisplay {
displayParts.push(...resolvedInfo.displayParts);
displayParts.push(lineBreakPart());
documentationFromAlias = resolvedInfo.documentation;
tagsFromAlias = resolvedInfo.tags;
}
}
}
@@ -512,6 +523,9 @@ namespace ts.SymbolDisplay {
if (documentation.length === 0 && documentationFromAlias) {
documentation = documentationFromAlias;
}
if (tags.length === 0 && tagsFromAlias) {
tags = tagsFromAlias;
}
return { displayParts, documentation, symbolKind, tags };
+8 -28
View File
@@ -1051,6 +1051,7 @@ declare namespace ts {
interface TaggedTemplateExpression extends MemberExpression {
kind: SyntaxKind.TaggedTemplateExpression;
tag: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
template: TemplateLiteral;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
@@ -1160,7 +1161,7 @@ declare namespace ts {
interface DebuggerStatement extends Statement {
kind: SyntaxKind.DebuggerStatement;
}
interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
interface MissingDeclaration extends DeclarationStatement {
kind: SyntaxKind.MissingDeclaration;
name?: Identifier;
}
@@ -2889,6 +2890,7 @@ declare namespace ts {
newLine: string;
useCaseSensitiveFileNames: boolean;
write(s: string): void;
writeOutputIsTTY?(): boolean;
readFile(path: string, encoding?: string): string | undefined;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
@@ -3169,6 +3171,7 @@ declare namespace ts {
function isIndexedAccessTypeNode(node: Node): node is IndexedAccessTypeNode;
function isMappedTypeNode(node: Node): node is MappedTypeNode;
function isLiteralTypeNode(node: Node): node is LiteralTypeNode;
function isImportTypeNode(node: Node): node is ImportTypeNode;
function isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
function isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
function isBindingElement(node: Node): node is BindingElement;
@@ -3522,7 +3525,9 @@ declare namespace ts {
function createNew(expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
function updateNew(node: NewExpression, expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion;
function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion;
function createParen(expression: Expression): ParenthesizedExpression;
@@ -7607,17 +7612,6 @@ declare namespace ts.server {
readonly globalTypingsCacheLocation: string;
}
const nullTypingsInstaller: ITypingsInstaller;
class TypingsCache {
private readonly installer;
private readonly perProjectCache;
constructor(installer: ITypingsInstaller);
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptionsWithProject): Promise<ApplyCodeActionCommandResult>;
getTypingsForProject(project: Project, unresolvedImports: SortedReadonlyArray<string>, forceRefresh: boolean): SortedReadonlyArray<string>;
updateTypingsForProject(projectName: string, compilerOptions: CompilerOptions, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, newTypings: string[]): void;
deleteTypingsForProject(projectName: string): void;
onProjectClosed(project: Project): void;
}
}
declare namespace ts.server {
enum ProjectKind {
@@ -7627,15 +7621,6 @@ declare namespace ts.server {
}
function allRootFilesAreJsOrDts(project: Project): boolean;
function allFilesAreJsOrDts(project: Project): boolean;
class UnresolvedImportsMap {
readonly perFileMap: Map<ReadonlyArray<string>>;
private version;
clear(): void;
getVersion(): number;
remove(path: Path): void;
get(path: Path): ReadonlyArray<string>;
set(path: Path, value: ReadonlyArray<string>): void;
}
interface PluginCreateInfo {
project: Project;
languageService: LanguageService;
@@ -7668,8 +7653,6 @@ declare namespace ts.server {
private externalFiles;
private missingFilesMap;
private plugins;
private cachedUnresolvedImportsPerFile;
private lastCachedUnresolvedImportsList;
private lastFileExceededProgramSize;
protected languageService: LanguageService;
languageServiceEnabled: boolean;
@@ -7689,10 +7672,10 @@ declare namespace ts.server {
*/
private lastReportedVersion;
/**
* Current project structure version.
* Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
* This property is changed in 'updateGraph' based on the set of files in program
*/
private projectStructureVersion;
private projectProgramVersion;
/**
* Current version of the project state. It is changed when:
* - new root file was added/removed
@@ -7700,11 +7683,9 @@ declare namespace ts.server {
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
*/
private projectStateVersion;
private typingFiles;
private readonly cancellationToken;
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
getCachedUnresolvedImportsPerFile_TestOnly(): UnresolvedImportsMap;
static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {};
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
@@ -7965,7 +7946,6 @@ declare namespace ts.server {
syntaxOnly?: boolean;
}
class ProjectService {
readonly typingsCache: TypingsCache;
private readonly documentRegistry;
/**
* Container of all known scripts
+6 -1
View File
@@ -1051,6 +1051,7 @@ declare namespace ts {
interface TaggedTemplateExpression extends MemberExpression {
kind: SyntaxKind.TaggedTemplateExpression;
tag: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
template: TemplateLiteral;
}
type CallLikeExpression = CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxOpeningLikeElement;
@@ -1160,7 +1161,7 @@ declare namespace ts {
interface DebuggerStatement extends Statement {
kind: SyntaxKind.DebuggerStatement;
}
interface MissingDeclaration extends DeclarationStatement, ClassElement, ObjectLiteralElement, TypeElement {
interface MissingDeclaration extends DeclarationStatement {
kind: SyntaxKind.MissingDeclaration;
name?: Identifier;
}
@@ -2889,6 +2890,7 @@ declare namespace ts {
newLine: string;
useCaseSensitiveFileNames: boolean;
write(s: string): void;
writeOutputIsTTY?(): boolean;
readFile(path: string, encoding?: string): string | undefined;
getFileSize?(path: string): number;
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
@@ -3169,6 +3171,7 @@ declare namespace ts {
function isIndexedAccessTypeNode(node: Node): node is IndexedAccessTypeNode;
function isMappedTypeNode(node: Node): node is MappedTypeNode;
function isLiteralTypeNode(node: Node): node is LiteralTypeNode;
function isImportTypeNode(node: Node): node is ImportTypeNode;
function isObjectBindingPattern(node: Node): node is ObjectBindingPattern;
function isArrayBindingPattern(node: Node): node is ArrayBindingPattern;
function isBindingElement(node: Node): node is BindingElement;
@@ -3522,7 +3525,9 @@ declare namespace ts {
function createNew(expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
function updateNew(node: NewExpression, expression: Expression, typeArguments: ReadonlyArray<TypeNode> | undefined, argumentsArray: ReadonlyArray<Expression> | undefined): NewExpression;
function createTaggedTemplate(tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
function createTaggedTemplate(tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, template: TemplateLiteral): TaggedTemplateExpression;
function updateTaggedTemplate(node: TaggedTemplateExpression, tag: Expression, typeArguments: ReadonlyArray<TypeNode>, template: TemplateLiteral): TaggedTemplateExpression;
function createTypeAssertion(type: TypeNode, expression: Expression): TypeAssertion;
function updateTypeAssertion(node: TypeAssertion, type: TypeNode, expression: Expression): TypeAssertion;
function createParen(expression: Expression): ParenthesizedExpression;
@@ -0,0 +1,27 @@
=== tests/cases/compiler/file.ts ===
class Foo {
>Foo : Symbol(Foo, Decl(file.ts, 0, 0))
x: number;
>x : Symbol(Foo.x, Decl(file.ts, 0, 11))
}
declare global {
>global : Symbol(global, Decl(file.ts, 2, 1))
var module: any; // Just here to remove unrelated error from test
>module : Symbol(module, Decl(file.ts, 5, 7))
}
export = Foo;
>Foo : Symbol(Foo, Decl(file.ts, 0, 0))
=== tests/cases/compiler/something.js ===
/** @typedef {typeof import("./file")} Foo */
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
>module : Symbol(export=, Decl(something.js, 0, 0))
>exports : Symbol(export=, Decl(something.js, 0, 0))
@@ -0,0 +1,32 @@
=== tests/cases/compiler/file.ts ===
class Foo {
>Foo : Foo
x: number;
>x : number
}
declare global {
>global : typeof global
var module: any; // Just here to remove unrelated error from test
>module : any
}
export = Foo;
>Foo : Foo
=== tests/cases/compiler/something.js ===
/** @typedef {typeof import("./file")} Foo */
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
>module.exports = /** @type {FooFun} */(void 0) : (foo: typeof Foo) => string
>module.exports : any
>module : any
>exports : any
>(void 0) : (foo: typeof Foo) => string
>void 0 : undefined
>0 : 0
@@ -0,0 +1,8 @@
tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts(1,16): error TS2307: Cannot find module 'module-not-existed'.
==== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts (1 errors) ====
import {} from 'module-not-existed'
~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module 'module-not-existed'.
@@ -0,0 +1,7 @@
//// [importEmptyFromModuleNotExisted.ts]
import {} from 'module-not-existed'
//// [importEmptyFromModuleNotExisted.js]
"use strict";
exports.__esModule = true;
@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts ===
import {} from 'module-not-existed'
No type information for this code.
No type information for this code.
@@ -0,0 +1,4 @@
=== tests/cases/conformance/es6/modules/importEmptyFromModuleNotExisted.ts ===
import {} from 'module-not-existed'
No type information for this code.
No type information for this code.
@@ -0,0 +1,14 @@
=== tests/cases/compiler/interfaces.d.ts ===
export interface Bar {
>Bar : Symbol(Bar, Decl(interfaces.d.ts, 0, 0))
prop: string
>prop : Symbol(Bar.prop, Decl(interfaces.d.ts, 0, 22))
}
=== tests/cases/compiler/usage.js ===
/** @type {Bar} */
export let bar;
>bar : Symbol(bar, Decl(usage.js, 1, 10))
/** @typedef {import('./interfaces').Bar} Bar */
@@ -0,0 +1,14 @@
=== tests/cases/compiler/interfaces.d.ts ===
export interface Bar {
>Bar : Bar
prop: string
>prop : string
}
=== tests/cases/compiler/usage.js ===
/** @type {Bar} */
export let bar;
>bar : Bar
/** @typedef {import('./interfaces').Bar} Bar */
@@ -0,0 +1,31 @@
tests/cases/conformance/jsdoc/templateTagOnClasses.js(24,1): error TS2322: Type 'boolean' is not assignable to type 'number'.
==== tests/cases/conformance/jsdoc/templateTagOnClasses.js (1 errors) ====
/**
* @template {T}
* @typedef {(t: T) => T} Id
*/
class Foo {
/** @typedef {(t: T) => T} Id2 */
/** @param {T} x */
constructor (x) {
this.a = x
}
/**
*
* @param {T} x
* @param {Id} y
* @param {Id2} alpha
* @return {T}
*/
foo(x, y, alpha) {
return alpha(y(x))
}
}
var f = new Foo(1)
var g = new Foo(false)
f.a = g.a
~~~
!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
@@ -0,0 +1,54 @@
=== tests/cases/conformance/jsdoc/templateTagOnClasses.js ===
/**
* @template {T}
* @typedef {(t: T) => T} Id
*/
class Foo {
>Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0))
/** @typedef {(t: T) => T} Id2 */
/** @param {T} x */
constructor (x) {
>x : Symbol(x, Decl(templateTagOnClasses.js, 7, 17))
this.a = x
>this.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
>this : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0))
>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
>x : Symbol(x, Decl(templateTagOnClasses.js, 7, 17))
}
/**
*
* @param {T} x
* @param {Id} y
* @param {Id2} alpha
* @return {T}
*/
foo(x, y, alpha) {
>foo : Symbol(Foo.foo, Decl(templateTagOnClasses.js, 9, 5))
>x : Symbol(x, Decl(templateTagOnClasses.js, 17, 8))
>y : Symbol(y, Decl(templateTagOnClasses.js, 17, 10))
>alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 17, 13))
return alpha(y(x))
>alpha : Symbol(alpha, Decl(templateTagOnClasses.js, 17, 13))
>y : Symbol(y, Decl(templateTagOnClasses.js, 17, 10))
>x : Symbol(x, Decl(templateTagOnClasses.js, 17, 8))
}
}
var f = new Foo(1)
>f : Symbol(f, Decl(templateTagOnClasses.js, 21, 3))
>Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0))
var g = new Foo(false)
>g : Symbol(g, Decl(templateTagOnClasses.js, 22, 3))
>Foo : Symbol(Foo, Decl(templateTagOnClasses.js, 0, 0))
f.a = g.a
>f.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
>f : Symbol(f, Decl(templateTagOnClasses.js, 21, 3))
>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
>g.a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
>g : Symbol(g, Decl(templateTagOnClasses.js, 22, 3))
>a : Symbol(Foo.a, Decl(templateTagOnClasses.js, 7, 21))
@@ -0,0 +1,62 @@
=== tests/cases/conformance/jsdoc/templateTagOnClasses.js ===
/**
* @template {T}
* @typedef {(t: T) => T} Id
*/
class Foo {
>Foo : Foo<T>
/** @typedef {(t: T) => T} Id2 */
/** @param {T} x */
constructor (x) {
>x : T
this.a = x
>this.a = x : T
>this.a : T
>this : this
>a : T
>x : T
}
/**
*
* @param {T} x
* @param {Id} y
* @param {Id2} alpha
* @return {T}
*/
foo(x, y, alpha) {
>foo : (x: T, y: (t: T) => T, alpha: (t: T) => T) => T
>x : T
>y : (t: T) => T
>alpha : (t: T) => T
return alpha(y(x))
>alpha(y(x)) : T
>alpha : (t: T) => T
>y(x) : T
>y : (t: T) => T
>x : T
}
}
var f = new Foo(1)
>f : Foo<number>
>new Foo(1) : Foo<number>
>Foo : typeof Foo
>1 : 1
var g = new Foo(false)
>g : Foo<boolean>
>new Foo(false) : Foo<boolean>
>Foo : typeof Foo
>false : false
f.a = g.a
>f.a = g.a : boolean
>f.a : number
>f : Foo<number>
>a : number
>g.a : boolean
>g : Foo<boolean>
>a : boolean
@@ -0,0 +1,28 @@
tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js(21,1): error TS2322: Type 'false' is not assignable to type 'number'.
==== tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js (1 errors) ====
/**
* @template {T}
* @typedef {(t: T) => T} Id
* @param {T} t
*/
function Zet(t) {
/** @type {T} */
this.u
this.t = t
}
/**
* @param {T} v
* @param {Id} id
*/
Zet.prototype.add = function(v, id) {
this.u = v || this.t
return id(this.u)
}
var z = new Zet(1)
z.t = 2
z.u = false
~~~
!!! error TS2322: Type 'false' is not assignable to type 'number'.
@@ -0,0 +1,57 @@
=== tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js ===
/**
* @template {T}
* @typedef {(t: T) => T} Id
* @param {T} t
*/
function Zet(t) {
>Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 5, 13))
/** @type {T} */
this.u
this.t = t
>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10))
>t : Symbol(t, Decl(templateTagOnConstructorFunctions.js, 5, 13))
}
/**
* @param {T} v
* @param {Id} id
*/
Zet.prototype.add = function(v, id) {
>Zet.prototype : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 9, 1))
>Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>prototype : Symbol(Function.prototype, Decl(lib.d.ts, --, --))
>add : Symbol(Zet.add, Decl(templateTagOnConstructorFunctions.js, 9, 1))
>v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 14, 29))
>id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 14, 31))
this.u = v || this.t
>this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
>this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
>v : Symbol(v, Decl(templateTagOnConstructorFunctions.js, 14, 29))
>this.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10))
>this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10))
return id(this.u)
>id : Symbol(id, Decl(templateTagOnConstructorFunctions.js, 14, 31))
>this.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
>this : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
}
var z = new Zet(1)
>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3))
>Zet : Symbol(Zet, Decl(templateTagOnConstructorFunctions.js, 0, 0))
z.t = 2
>z.t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10))
>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3))
>t : Symbol(Zet.t, Decl(templateTagOnConstructorFunctions.js, 7, 10))
z.u = false
>z.u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
>z : Symbol(z, Decl(templateTagOnConstructorFunctions.js, 18, 3))
>u : Symbol(Zet.u, Decl(templateTagOnConstructorFunctions.js, 5, 17), Decl(templateTagOnConstructorFunctions.js, 14, 37))
@@ -0,0 +1,76 @@
=== tests/cases/conformance/jsdoc/templateTagOnConstructorFunctions.js ===
/**
* @template {T}
* @typedef {(t: T) => T} Id
* @param {T} t
*/
function Zet(t) {
>Zet : typeof Zet
>t : T
/** @type {T} */
this.u
>this.u : any
>this : any
>u : any
this.t = t
>this.t = t : T
>this.t : any
>this : any
>t : any
>t : T
}
/**
* @param {T} v
* @param {Id} id
*/
Zet.prototype.add = function(v, id) {
>Zet.prototype.add = function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (t: T) => T) => T
>Zet.prototype.add : any
>Zet.prototype : any
>Zet : typeof Zet
>prototype : any
>add : any
>function(v, id) { this.u = v || this.t return id(this.u)} : (v: T, id: (t: T) => T) => T
>v : T
>id : (t: T) => T
this.u = v || this.t
>this.u = v || this.t : T
>this.u : T
>this : Zet
>u : T
>v || this.t : T
>v : T
>this.t : T
>this : Zet
>t : T
return id(this.u)
>id(this.u) : T
>id : (t: T) => T
>this.u : T
>this : Zet
>u : T
}
var z = new Zet(1)
>z : typeof Zet
>new Zet(1) : typeof Zet
>Zet : typeof Zet
>1 : 1
z.t = 2
>z.t = 2 : 2
>z.t : number
>z : typeof Zet
>t : number
>2 : 2
z.u = false
>z.u = false : false
>z.u : number
>z : typeof Zet
>u : number
>false : false
+48 -48
View File
@@ -91,9 +91,9 @@ async function F() {
>e : Symbol(e, Decl(promiseType.ts, 47, 11))
return Promise.reject(Error());
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
}
@@ -150,9 +150,9 @@ async function I() {
>e : Symbol(e, Decl(promiseType.ts, 77, 11))
return Promise.reject(Error());
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
}
@@ -227,9 +227,9 @@ const p18 = p.catch(() => Promise.reject(1));
>p.catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p19 = p.catch(() => Promise.resolve(1));
>p19 : Symbol(p19, Decl(promiseType.ts, 96, 5))
@@ -305,9 +305,9 @@ const p29 = p.then(() => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p30 = p.then(undefined, undefined);
>p30 : Symbol(p30, Decl(promiseType.ts, 109, 5))
@@ -384,9 +384,9 @@ const p39 = p.then(undefined, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p40 = p.then(null, undefined);
>p40 : Symbol(p40, Decl(promiseType.ts, 120, 5))
@@ -453,9 +453,9 @@ const p49 = p.then(null, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p50 = p.then(() => "1", undefined);
>p50 : Symbol(p50, Decl(promiseType.ts, 131, 5))
@@ -522,9 +522,9 @@ const p59 = p.then(() => "1", () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p60 = p.then(() => x, undefined);
>p60 : Symbol(p60, Decl(promiseType.ts, 142, 5))
@@ -601,9 +601,9 @@ const p69 = p.then(() => x, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(promiseType.ts, 1, 11))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p70 = p.then(() => undefined, undefined);
>p70 : Symbol(p70, Decl(promiseType.ts, 153, 5))
@@ -680,9 +680,9 @@ const p79 = p.then(() => undefined, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p80 = p.then(() => null, undefined);
>p80 : Symbol(p80, Decl(promiseType.ts, 164, 5))
@@ -749,9 +749,9 @@ const p89 = p.then(() => null, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p90 = p.then(() => {}, undefined);
>p90 : Symbol(p90, Decl(promiseType.ts, 175, 5))
@@ -818,9 +818,9 @@ const p99 = p.then(() => {}, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pa0 = p.then(() => {throw 1}, undefined);
>pa0 : Symbol(pa0, Decl(promiseType.ts, 186, 5))
@@ -887,9 +887,9 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pb0 = p.then(() => Promise.resolve("1"), undefined);
>pb0 : Symbol(pb0, Decl(promiseType.ts, 197, 5))
@@ -986,18 +986,18 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1));
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc0 = p.then(() => Promise.reject("1"), undefined);
>pc0 : Symbol(pc0, Decl(promiseType.ts, 208, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>undefined : Symbol(undefined)
const pc1 = p.then(() => Promise.reject("1"), null);
@@ -1005,27 +1005,27 @@ const pc1 = p.then(() => Promise.reject("1"), null);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc2 = p.then(() => Promise.reject("1"), () => 1);
>pc2 : Symbol(pc2, Decl(promiseType.ts, 210, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc3 = p.then(() => Promise.reject("1"), () => x);
>pc3 : Symbol(pc3, Decl(promiseType.ts, 211, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>x : Symbol(x, Decl(promiseType.ts, 1, 11))
const pc4 = p.then(() => Promise.reject("1"), () => undefined);
@@ -1033,9 +1033,9 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>undefined : Symbol(undefined)
const pc5 = p.then(() => Promise.reject("1"), () => null);
@@ -1043,36 +1043,36 @@ const pc5 = p.then(() => Promise.reject("1"), () => null);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc6 = p.then(() => Promise.reject("1"), () => {});
>pc6 : Symbol(pc6, Decl(promiseType.ts, 214, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
>pc7 : Symbol(pc7, Decl(promiseType.ts, 215, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
>pc8 : Symbol(pc8, Decl(promiseType.ts, 216, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
@@ -1082,10 +1082,10 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseType.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
+48 -48
View File
@@ -105,9 +105,9 @@ async function F() {
return Promise.reject(Error());
>Promise.reject(Error()) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>Error() : Error
>Error : ErrorConstructor
}
@@ -170,9 +170,9 @@ async function I() {
return Promise.reject(Error());
>Promise.reject(Error()) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>Error() : Error
>Error : ErrorConstructor
}
@@ -271,9 +271,9 @@ const p18 = p.catch(() => Promise.reject(1));
>catch : <TResult = never>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>) => Promise<boolean | TResult>
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p19 = p.catch(() => Promise.resolve(1));
@@ -379,9 +379,9 @@ const p29 = p.then(() => Promise.reject(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p30 = p.then(undefined, undefined);
@@ -484,9 +484,9 @@ const p39 = p.then(undefined, () => Promise.reject(1));
>undefined : undefined
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p40 = p.then(null, undefined);
@@ -589,9 +589,9 @@ const p49 = p.then(null, () => Promise.reject(1));
>null : null
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p50 = p.then(() => "1", undefined);
@@ -704,9 +704,9 @@ const p59 = p.then(() => "1", () => Promise.reject(1));
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p60 = p.then(() => x, undefined);
@@ -819,9 +819,9 @@ const p69 = p.then(() => x, () => Promise.reject(1));
>x : any
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p70 = p.then(() => undefined, undefined);
@@ -934,9 +934,9 @@ const p79 = p.then(() => undefined, () => Promise.reject(1));
>undefined : undefined
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p80 = p.then(() => null, undefined);
@@ -1049,9 +1049,9 @@ const p89 = p.then(() => null, () => Promise.reject(1));
>null : null
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p90 = p.then(() => {}, undefined);
@@ -1154,9 +1154,9 @@ const p99 = p.then(() => {}, () => Promise.reject(1));
>() => {} : () => void
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pa0 = p.then(() => {throw 1}, undefined);
@@ -1269,9 +1269,9 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1));
>1 : 1
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pb0 = p.then(() => Promise.resolve("1"), undefined);
@@ -1424,9 +1424,9 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1));
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pc0 = p.then(() => Promise.reject("1"), undefined);
@@ -1437,9 +1437,9 @@ const pc0 = p.then(() => Promise.reject("1"), undefined);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>undefined : undefined
@@ -1451,9 +1451,9 @@ const pc1 = p.then(() => Promise.reject("1"), null);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>null : null
@@ -1465,9 +1465,9 @@ const pc2 = p.then(() => Promise.reject("1"), () => 1);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => 1 : () => number
>1 : 1
@@ -1480,9 +1480,9 @@ const pc3 = p.then(() => Promise.reject("1"), () => x);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => x : () => any
>x : any
@@ -1495,9 +1495,9 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => undefined : () => any
>undefined : undefined
@@ -1510,9 +1510,9 @@ const pc5 = p.then(() => Promise.reject("1"), () => null);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => null : () => any
>null : null
@@ -1525,9 +1525,9 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => {} : () => void
@@ -1539,9 +1539,9 @@ const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => {throw 1} : () => never
>1 : 1
@@ -1554,9 +1554,9 @@ const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => Promise.resolve(1) : () => Promise<number>
>Promise.resolve(1) : Promise<number>
@@ -1573,14 +1573,14 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: (value: boolean) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
@@ -91,9 +91,9 @@ async function F() {
>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 47, 11))
return Promise.reject(Error());
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
}
@@ -150,9 +150,9 @@ async function I() {
>e : Symbol(e, Decl(promiseTypeStrictNull.ts, 77, 11))
return Promise.reject(Error());
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
}
}
@@ -227,9 +227,9 @@ const p18 = p.catch(() => Promise.reject(1));
>p.catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>catch : Symbol(Promise.catch, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p19 = p.catch(() => Promise.resolve(1));
>p19 : Symbol(p19, Decl(promiseTypeStrictNull.ts, 96, 5))
@@ -305,9 +305,9 @@ const p29 = p.then(() => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p30 = p.then(undefined, undefined);
>p30 : Symbol(p30, Decl(promiseTypeStrictNull.ts, 109, 5))
@@ -384,9 +384,9 @@ const p39 = p.then(undefined, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p40 = p.then(null, undefined);
>p40 : Symbol(p40, Decl(promiseTypeStrictNull.ts, 120, 5))
@@ -453,9 +453,9 @@ const p49 = p.then(null, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p50 = p.then(() => "1", undefined);
>p50 : Symbol(p50, Decl(promiseTypeStrictNull.ts, 131, 5))
@@ -522,9 +522,9 @@ const p59 = p.then(() => "1", () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p60 = p.then(() => x, undefined);
>p60 : Symbol(p60, Decl(promiseTypeStrictNull.ts, 142, 5))
@@ -601,9 +601,9 @@ const p69 = p.then(() => x, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p70 = p.then(() => undefined, undefined);
>p70 : Symbol(p70, Decl(promiseTypeStrictNull.ts, 153, 5))
@@ -680,9 +680,9 @@ const p79 = p.then(() => undefined, () => Promise.reject(1));
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p80 = p.then(() => null, undefined);
>p80 : Symbol(p80, Decl(promiseTypeStrictNull.ts, 164, 5))
@@ -749,9 +749,9 @@ const p89 = p.then(() => null, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const p90 = p.then(() => {}, undefined);
>p90 : Symbol(p90, Decl(promiseTypeStrictNull.ts, 175, 5))
@@ -818,9 +818,9 @@ const p99 = p.then(() => {}, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pa0 = p.then(() => {throw 1}, undefined);
>pa0 : Symbol(pa0, Decl(promiseTypeStrictNull.ts, 186, 5))
@@ -887,9 +887,9 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pb0 = p.then(() => Promise.resolve("1"), undefined);
>pb0 : Symbol(pb0, Decl(promiseTypeStrictNull.ts, 197, 5))
@@ -986,18 +986,18 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1));
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc0 = p.then(() => Promise.reject("1"), undefined);
>pc0 : Symbol(pc0, Decl(promiseTypeStrictNull.ts, 208, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>undefined : Symbol(undefined)
const pc1 = p.then(() => Promise.reject("1"), null);
@@ -1005,27 +1005,27 @@ const pc1 = p.then(() => Promise.reject("1"), null);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc2 = p.then(() => Promise.reject("1"), () => 1);
>pc2 : Symbol(pc2, Decl(promiseTypeStrictNull.ts, 210, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc3 = p.then(() => Promise.reject("1"), () => x);
>pc3 : Symbol(pc3, Decl(promiseTypeStrictNull.ts, 211, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>x : Symbol(x, Decl(promiseTypeStrictNull.ts, 1, 11))
const pc4 = p.then(() => Promise.reject("1"), () => undefined);
@@ -1033,9 +1033,9 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>undefined : Symbol(undefined)
const pc5 = p.then(() => Promise.reject("1"), () => null);
@@ -1043,36 +1043,36 @@ const pc5 = p.then(() => Promise.reject("1"), () => null);
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc6 = p.then(() => Promise.reject("1"), () => {});
>pc6 : Symbol(pc6, Decl(promiseTypeStrictNull.ts, 214, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
>pc7 : Symbol(pc7, Decl(promiseTypeStrictNull.ts, 215, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
>pc8 : Symbol(pc8, Decl(promiseTypeStrictNull.ts, 216, 5))
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
@@ -1082,10 +1082,10 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>p.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>p : Symbol(p, Decl(promiseTypeStrictNull.ts, 0, 11))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise.reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))
@@ -105,9 +105,9 @@ async function F() {
return Promise.reject(Error());
>Promise.reject(Error()) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>Error() : Error
>Error : ErrorConstructor
}
@@ -170,9 +170,9 @@ async function I() {
return Promise.reject(Error());
>Promise.reject(Error()) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>Error() : Error
>Error : ErrorConstructor
}
@@ -271,9 +271,9 @@ const p18 = p.catch(() => Promise.reject(1));
>catch : <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<boolean | TResult>
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p19 = p.catch(() => Promise.resolve(1));
@@ -379,9 +379,9 @@ const p29 = p.then(() => Promise.reject(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p30 = p.then(undefined, undefined);
@@ -484,9 +484,9 @@ const p39 = p.then(undefined, () => Promise.reject(1));
>undefined : undefined
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p40 = p.then(null, undefined);
@@ -589,9 +589,9 @@ const p49 = p.then(null, () => Promise.reject(1));
>null : null
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p50 = p.then(() => "1", undefined);
@@ -704,9 +704,9 @@ const p59 = p.then(() => "1", () => Promise.reject(1));
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p60 = p.then(() => x, undefined);
@@ -819,9 +819,9 @@ const p69 = p.then(() => x, () => Promise.reject(1));
>x : any
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p70 = p.then(() => undefined, undefined);
@@ -934,9 +934,9 @@ const p79 = p.then(() => undefined, () => Promise.reject(1));
>undefined : undefined
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p80 = p.then(() => null, undefined);
@@ -1049,9 +1049,9 @@ const p89 = p.then(() => null, () => Promise.reject(1));
>null : null
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const p90 = p.then(() => {}, undefined);
@@ -1154,9 +1154,9 @@ const p99 = p.then(() => {}, () => Promise.reject(1));
>() => {} : () => void
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pa0 = p.then(() => {throw 1}, undefined);
@@ -1269,9 +1269,9 @@ const pa9 = p.then(() => {throw 1}, () => Promise.reject(1));
>1 : 1
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pb0 = p.then(() => Promise.resolve("1"), undefined);
@@ -1424,9 +1424,9 @@ const pb9 = p.then(() => Promise.resolve("1"), () => Promise.reject(1));
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
const pc0 = p.then(() => Promise.reject("1"), undefined);
@@ -1437,9 +1437,9 @@ const pc0 = p.then(() => Promise.reject("1"), undefined);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>undefined : undefined
@@ -1451,9 +1451,9 @@ const pc1 = p.then(() => Promise.reject("1"), null);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>null : null
@@ -1465,9 +1465,9 @@ const pc2 = p.then(() => Promise.reject("1"), () => 1);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => 1 : () => number
>1 : 1
@@ -1480,9 +1480,9 @@ const pc3 = p.then(() => Promise.reject("1"), () => x);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => x : () => any
>x : any
@@ -1495,9 +1495,9 @@ const pc4 = p.then(() => Promise.reject("1"), () => undefined);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => undefined : () => undefined
>undefined : undefined
@@ -1510,9 +1510,9 @@ const pc5 = p.then(() => Promise.reject("1"), () => null);
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => null : () => null
>null : null
@@ -1525,9 +1525,9 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => {} : () => void
@@ -1539,9 +1539,9 @@ const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => {throw 1} : () => never
>1 : 1
@@ -1554,9 +1554,9 @@ const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => Promise.resolve(1) : () => Promise<number>
>Promise.resolve(1) : Promise<number>
@@ -1573,14 +1573,14 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>then : <TResult1 = boolean, TResult2 = never>(onfulfilled?: ((value: boolean) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>
>() => Promise.reject("1") : () => Promise<never>
>Promise.reject("1") : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>"1" : "1"
>() => Promise.reject(1) : () => Promise<never>
>Promise.reject(1) : Promise<never>
>Promise.reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>Promise.reject : <T = never>(reason?: any) => Promise<T>
>Promise : PromiseConstructor
>reject : { (reason: any): Promise<never>; <T>(reason: any): Promise<T>; }
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1
@@ -0,0 +1,72 @@
//// [taggedTemplatesWithTypeArguments1.ts]
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
interface Stuff {
x: number;
y: string;
z: boolean;
}
export const a = f<Stuff> `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
declare function g<Input, T, U, V>(
strs: TemplateStringsArray,
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
export const b = g<Stuff, number, string, boolean> `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
declare let obj: {
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
returnedObjProp: T
}
}
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
//// [taggedTemplatesWithTypeArguments1.js]
export const a = f `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
export const b = g `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
export let c = obj["prop"] `${(input) => ({ ...input })}`;
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
c = obj.prop `${(input) => ({ ...input })}`;
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
@@ -0,0 +1,186 @@
=== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts ===
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
>f : Symbol(f, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 0))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 19))
>strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 22))
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
>callbacks : Symbol(callbacks, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 49))
>Array : Symbol(Array, Decl(lib.es2016.array.include.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --) ... and 1 more)
>x : Symbol(x, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 71))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 19))
interface Stuff {
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
x: number;
>x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
y: string;
>y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
z: boolean;
>z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
}
export const a = f<Stuff> `
>a : Symbol(a, Decl(taggedTemplatesWithTypeArguments1.ts, 8, 12))
>f : Symbol(f, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 0))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
hello
${stuff => stuff.x}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 10, 6))
>stuff.x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 10, 6))
>x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
brave
${stuff => stuff.y}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 12, 6))
>stuff.y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 12, 6))
>y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
world
${stuff => stuff.z}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 14, 6))
>stuff.z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 14, 6))
>z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
`;
declare function g<Input, T, U, V>(
>g : Symbol(g, Decl(taggedTemplatesWithTypeArguments1.ts, 15, 2))
>Input : Symbol(Input, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 19))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 25))
>U : Symbol(U, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 28))
>V : Symbol(V, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 31))
strs: TemplateStringsArray,
>strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 35))
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
>t : Symbol(t, Decl(taggedTemplatesWithTypeArguments1.ts, 18, 31))
>i : Symbol(i, Decl(taggedTemplatesWithTypeArguments1.ts, 19, 8))
>Input : Symbol(Input, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 19))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 25))
>u : Symbol(u, Decl(taggedTemplatesWithTypeArguments1.ts, 19, 23))
>i : Symbol(i, Decl(taggedTemplatesWithTypeArguments1.ts, 19, 28))
>Input : Symbol(Input, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 19))
>U : Symbol(U, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 28))
>v : Symbol(v, Decl(taggedTemplatesWithTypeArguments1.ts, 19, 43))
>i : Symbol(i, Decl(taggedTemplatesWithTypeArguments1.ts, 19, 48))
>Input : Symbol(Input, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 19))
>V : Symbol(V, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 31))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 25))
>U : Symbol(U, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 28))
>V : Symbol(V, Decl(taggedTemplatesWithTypeArguments1.ts, 17, 31))
export const b = g<Stuff, number, string, boolean> `
>b : Symbol(b, Decl(taggedTemplatesWithTypeArguments1.ts, 21, 12))
>g : Symbol(g, Decl(taggedTemplatesWithTypeArguments1.ts, 15, 2))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
hello
${stuff => stuff.x}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 23, 6))
>stuff.x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 23, 6))
>x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
brave
${stuff => stuff.y}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 25, 6))
>stuff.y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 25, 6))
>y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
world
${stuff => stuff.z}
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 27, 6))
>stuff.z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
>stuff : Symbol(stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 27, 6))
>z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
`;
declare let obj: {
>obj : Symbol(obj, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 11))
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
>prop : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
>strs : Symbol(strs, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 14))
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
>x : Symbol(x, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 41))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 46))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
returnedObjProp: T
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 11))
}
}
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>obj : Symbol(obj, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 11))
>"prop" : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 38))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 38))
c.returnedObjProp.x;
>c.returnedObjProp.x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
c.returnedObjProp.y;
>c.returnedObjProp.y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
c.returnedObjProp.z;
>c.returnedObjProp.z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>obj.prop : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>obj : Symbol(obj, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 11))
>prop : Symbol(prop, Decl(taggedTemplatesWithTypeArguments1.ts, 30, 18))
>Stuff : Symbol(Stuff, Decl(taggedTemplatesWithTypeArguments1.ts, 0, 92))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 41, 24))
>input : Symbol(input, Decl(taggedTemplatesWithTypeArguments1.ts, 41, 24))
c.returnedObjProp.x;
>c.returnedObjProp.x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>x : Symbol(Stuff.x, Decl(taggedTemplatesWithTypeArguments1.ts, 2, 17))
c.returnedObjProp.y;
>c.returnedObjProp.y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>y : Symbol(Stuff.y, Decl(taggedTemplatesWithTypeArguments1.ts, 3, 14))
c.returnedObjProp.z;
>c.returnedObjProp.z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
>c.returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments1.ts, 36, 10))
>returnedObjProp : Symbol(returnedObjProp, Decl(taggedTemplatesWithTypeArguments1.ts, 31, 66))
>z : Symbol(Stuff.z, Decl(taggedTemplatesWithTypeArguments1.ts, 4, 14))
@@ -0,0 +1,208 @@
=== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments1.ts ===
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
>f : <T>(strs: TemplateStringsArray, ...callbacks: ((x: T) => any)[]) => void
>T : T
>strs : TemplateStringsArray
>TemplateStringsArray : TemplateStringsArray
>callbacks : ((x: T) => any)[]
>Array : T[]
>x : T
>T : T
interface Stuff {
>Stuff : Stuff
x: number;
>x : number
y: string;
>y : string
z: boolean;
>z : boolean
}
export const a = f<Stuff> `
>a : void
>f<Stuff> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : void
>f : <T>(strs: TemplateStringsArray, ...callbacks: ((x: T) => any)[]) => void
>Stuff : Stuff
>` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : string
hello
${stuff => stuff.x}
>stuff => stuff.x : (stuff: Stuff) => number
>stuff : Stuff
>stuff.x : number
>stuff : Stuff
>x : number
brave
${stuff => stuff.y}
>stuff => stuff.y : (stuff: Stuff) => string
>stuff : Stuff
>stuff.y : string
>stuff : Stuff
>y : string
world
${stuff => stuff.z}
>stuff => stuff.z : (stuff: Stuff) => boolean
>stuff : Stuff
>stuff.z : boolean
>stuff : Stuff
>z : boolean
`;
declare function g<Input, T, U, V>(
>g : <Input, T, U, V>(strs: TemplateStringsArray, t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V) => T | U | V
>Input : Input
>T : T
>U : U
>V : V
strs: TemplateStringsArray,
>strs : TemplateStringsArray
>TemplateStringsArray : TemplateStringsArray
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
>t : (i: Input) => T
>i : Input
>Input : Input
>T : T
>u : (i: Input) => U
>i : Input
>Input : Input
>U : U
>v : (i: Input) => V
>i : Input
>Input : Input
>V : V
>T : T
>U : U
>V : V
export const b = g<Stuff, number, string, boolean> `
>b : string | number | boolean
>g<Stuff, number, string, boolean> ` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : string | number | boolean
>g : <Input, T, U, V>(strs: TemplateStringsArray, t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V) => T | U | V
>Stuff : Stuff
>` hello ${stuff => stuff.x} brave ${stuff => stuff.y} world ${stuff => stuff.z}` : string
hello
${stuff => stuff.x}
>stuff => stuff.x : (stuff: Stuff) => number
>stuff : Stuff
>stuff.x : number
>stuff : Stuff
>x : number
brave
${stuff => stuff.y}
>stuff => stuff.y : (stuff: Stuff) => string
>stuff : Stuff
>stuff.y : string
>stuff : Stuff
>y : string
world
${stuff => stuff.z}
>stuff => stuff.z : (stuff: Stuff) => boolean
>stuff : Stuff
>stuff.z : boolean
>stuff : Stuff
>z : boolean
`;
declare let obj: {
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
>prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>T : T
>strs : TemplateStringsArray
>TemplateStringsArray : TemplateStringsArray
>x : (input: T) => T
>input : T
>T : T
>T : T
returnedObjProp: T
>returnedObjProp : T
>T : T
}
}
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
>c : { returnedObjProp: Stuff; }
>obj["prop"]<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: Stuff; }
>obj["prop"] : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
>"prop" : "prop"
>Stuff : Stuff
>`${(input) => ({ ...input })}` : string
>(input) => ({ ...input }) : (input: Stuff) => { x: number; y: string; z: boolean; }
>input : Stuff
>({ ...input }) : { x: number; y: string; z: boolean; }
>{ ...input } : { x: number; y: string; z: boolean; }
>input : Stuff
c.returnedObjProp.x;
>c.returnedObjProp.x : number
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>x : number
c.returnedObjProp.y;
>c.returnedObjProp.y : string
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>y : string
c.returnedObjProp.z;
>c.returnedObjProp.z : boolean
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>z : boolean
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
>c = obj.prop<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: Stuff; }
>c : { returnedObjProp: Stuff; }
>obj.prop<Stuff> `${(input) => ({ ...input })}` : { returnedObjProp: Stuff; }
>obj.prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>obj : { prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }; }
>prop : <T>(strs: TemplateStringsArray, x: (input: T) => T) => { returnedObjProp: T; }
>Stuff : Stuff
>`${(input) => ({ ...input })}` : string
>(input) => ({ ...input }) : (input: Stuff) => { x: number; y: string; z: boolean; }
>input : Stuff
>({ ...input }) : { x: number; y: string; z: boolean; }
>{ ...input } : { x: number; y: string; z: boolean; }
>input : Stuff
c.returnedObjProp.x;
>c.returnedObjProp.x : number
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>x : number
c.returnedObjProp.y;
>c.returnedObjProp.y : string
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>y : string
c.returnedObjProp.z;
>c.returnedObjProp.z : boolean
>c.returnedObjProp : Stuff
>c : { returnedObjProp: Stuff; }
>returnedObjProp : Stuff
>z : boolean
@@ -0,0 +1,61 @@
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(13,30): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(15,11): error TS2347: Untyped function calls may not accept type arguments.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(17,30): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(35,5): error TS2377: Constructors for derived classes must contain a 'super' call.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,9): error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts(36,14): error TS1034: 'super' must be followed by an argument list or member access.
==== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts (6 errors) ====
export interface SomethingTaggable {
<T>(t: TemplateStringsArray, ...args: T[]): SomethingNewable;
}
export interface SomethingNewable {
new <T>(...args: T[]): any;
}
declare const tag: SomethingTaggable;
const a = new tag `${100} ${200}`<string>("hello", "world");
const b = new tag<number> `${"hello"} ${"world"}`(100, 200);
~~~~~~~
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
const c = new tag<number> `${100} ${200}`<string>("hello", "world");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2347: Untyped function calls may not accept type arguments.
const d = new tag<number> `${"hello"} ${"world"}`<string>(100, 200);
~~~~~~~
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag<number>
`hello`();
class SomeBase<A, B, C> {
a!: A; b!: B; c!: C;
}
class SomeDerived<T> extends SomeBase<number, string, T> {
constructor() {
~~~~~~~~~~~~~~~
super<number, string, T> `hello world`;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS17011: 'super' must be called before accessing a property of 'super' in the constructor of a derived class.
~
!!! error TS1034: 'super' must be followed by an argument list or member access.
}
~~~~~
!!! error TS2377: Constructors for derived classes must contain a 'super' call.
}
@@ -0,0 +1,61 @@
//// [taggedTemplatesWithTypeArguments2.ts]
export interface SomethingTaggable {
<T>(t: TemplateStringsArray, ...args: T[]): SomethingNewable;
}
export interface SomethingNewable {
new <T>(...args: T[]): any;
}
declare const tag: SomethingTaggable;
const a = new tag `${100} ${200}`<string>("hello", "world");
const b = new tag<number> `${"hello"} ${"world"}`(100, 200);
const c = new tag<number> `${100} ${200}`<string>("hello", "world");
const d = new tag<number> `${"hello"} ${"world"}`<string>(100, 200);
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag<number>
`hello`();
class SomeBase<A, B, C> {
a!: A; b!: B; c!: C;
}
class SomeDerived<T> extends SomeBase<number, string, T> {
constructor() {
super<number, string, T> `hello world`;
}
}
//// [taggedTemplatesWithTypeArguments2.js]
const a = new tag `${100} ${200}`("hello", "world");
const b = new tag `${"hello"} ${"world"}`(100, 200);
const c = (new tag `${100} ${200}`)("hello", "world");
const d = (new tag `${"hello"} ${"world"}`)(100, 200);
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag `hello`();
class SomeBase {
}
class SomeDerived extends SomeBase {
constructor() {
super. `hello world`;
}
}
@@ -0,0 +1,83 @@
=== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts ===
export interface SomethingTaggable {
>SomethingTaggable : Symbol(SomethingTaggable, Decl(taggedTemplatesWithTypeArguments2.ts, 0, 0))
<T>(t: TemplateStringsArray, ...args: T[]): SomethingNewable;
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 1, 5))
>t : Symbol(t, Decl(taggedTemplatesWithTypeArguments2.ts, 1, 8))
>TemplateStringsArray : Symbol(TemplateStringsArray, Decl(lib.es5.d.ts, --, --))
>args : Symbol(args, Decl(taggedTemplatesWithTypeArguments2.ts, 1, 32))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 1, 5))
>SomethingNewable : Symbol(SomethingNewable, Decl(taggedTemplatesWithTypeArguments2.ts, 2, 1))
}
export interface SomethingNewable {
>SomethingNewable : Symbol(SomethingNewable, Decl(taggedTemplatesWithTypeArguments2.ts, 2, 1))
new <T>(...args: T[]): any;
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 5, 9))
>args : Symbol(args, Decl(taggedTemplatesWithTypeArguments2.ts, 5, 12))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 5, 9))
}
declare const tag: SomethingTaggable;
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
>SomethingTaggable : Symbol(SomethingTaggable, Decl(taggedTemplatesWithTypeArguments2.ts, 0, 0))
const a = new tag `${100} ${200}`<string>("hello", "world");
>a : Symbol(a, Decl(taggedTemplatesWithTypeArguments2.ts, 10, 5))
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
const b = new tag<number> `${"hello"} ${"world"}`(100, 200);
>b : Symbol(b, Decl(taggedTemplatesWithTypeArguments2.ts, 12, 5))
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
const c = new tag<number> `${100} ${200}`<string>("hello", "world");
>c : Symbol(c, Decl(taggedTemplatesWithTypeArguments2.ts, 14, 5))
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
const d = new tag<number> `${"hello"} ${"world"}`<string>(100, 200);
>d : Symbol(d, Decl(taggedTemplatesWithTypeArguments2.ts, 16, 5))
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag<number>
>e : Symbol(e, Decl(taggedTemplatesWithTypeArguments2.ts, 26, 5))
>tag : Symbol(tag, Decl(taggedTemplatesWithTypeArguments2.ts, 8, 13))
`hello`();
class SomeBase<A, B, C> {
>SomeBase : Symbol(SomeBase, Decl(taggedTemplatesWithTypeArguments2.ts, 27, 10))
>A : Symbol(A, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 15))
>B : Symbol(B, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 17))
>C : Symbol(C, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 20))
a!: A; b!: B; c!: C;
>a : Symbol(SomeBase.a, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 25))
>A : Symbol(A, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 15))
>b : Symbol(SomeBase.b, Decl(taggedTemplatesWithTypeArguments2.ts, 30, 10))
>B : Symbol(B, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 17))
>c : Symbol(SomeBase.c, Decl(taggedTemplatesWithTypeArguments2.ts, 30, 17))
>C : Symbol(C, Decl(taggedTemplatesWithTypeArguments2.ts, 29, 20))
}
class SomeDerived<T> extends SomeBase<number, string, T> {
>SomeDerived : Symbol(SomeDerived, Decl(taggedTemplatesWithTypeArguments2.ts, 31, 1))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 33, 18))
>SomeBase : Symbol(SomeBase, Decl(taggedTemplatesWithTypeArguments2.ts, 27, 10))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 33, 18))
constructor() {
super<number, string, T> `hello world`;
>super : Symbol(SomeBase, Decl(taggedTemplatesWithTypeArguments2.ts, 27, 10))
>T : Symbol(T, Decl(taggedTemplatesWithTypeArguments2.ts, 33, 18))
}
}
@@ -0,0 +1,120 @@
=== tests/cases/conformance/es6/templates/taggedTemplatesWithTypeArguments2.ts ===
export interface SomethingTaggable {
>SomethingTaggable : SomethingTaggable
<T>(t: TemplateStringsArray, ...args: T[]): SomethingNewable;
>T : T
>t : TemplateStringsArray
>TemplateStringsArray : TemplateStringsArray
>args : T[]
>T : T
>SomethingNewable : SomethingNewable
}
export interface SomethingNewable {
>SomethingNewable : SomethingNewable
new <T>(...args: T[]): any;
>T : T
>args : T[]
>T : T
}
declare const tag: SomethingTaggable;
>tag : SomethingTaggable
>SomethingTaggable : SomethingTaggable
const a = new tag `${100} ${200}`<string>("hello", "world");
>a : any
>new tag `${100} ${200}`<string>("hello", "world") : any
>tag `${100} ${200}` : SomethingNewable
>tag : SomethingTaggable
>`${100} ${200}` : string
>100 : 100
>200 : 200
>"hello" : "hello"
>"world" : "world"
const b = new tag<number> `${"hello"} ${"world"}`(100, 200);
>b : any
>new tag<number> `${"hello"} ${"world"}`(100, 200) : any
>tag<number> `${"hello"} ${"world"}` : any
>tag : SomethingTaggable
>`${"hello"} ${"world"}` : string
>"hello" : "hello"
>"world" : "world"
>100 : 100
>200 : 200
const c = new tag<number> `${100} ${200}`<string>("hello", "world");
>c : any
>new tag<number> `${100} ${200}`<string>("hello", "world") : any
>new tag<number> `${100} ${200}` : any
>tag<number> `${100} ${200}` : SomethingNewable
>tag : SomethingTaggable
>`${100} ${200}` : string
>100 : 100
>200 : 200
>"hello" : "hello"
>"world" : "world"
const d = new tag<number> `${"hello"} ${"world"}`<string>(100, 200);
>d : any
>new tag<number> `${"hello"} ${"world"}`<string>(100, 200) : any
>new tag<number> `${"hello"} ${"world"}` : any
>tag<number> `${"hello"} ${"world"}` : any
>tag : SomethingTaggable
>`${"hello"} ${"world"}` : string
>"hello" : "hello"
>"world" : "world"
>100 : 100
>200 : 200
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag<number>
>e : any
>new tag<number>`hello`() : any
>tag<number>`hello` : SomethingNewable
>tag : SomethingTaggable
`hello`();
>`hello` : "hello"
class SomeBase<A, B, C> {
>SomeBase : SomeBase<A, B, C>
>A : A
>B : B
>C : C
a!: A; b!: B; c!: C;
>a : A
>A : A
>b : B
>B : B
>c : C
>C : C
}
class SomeDerived<T> extends SomeBase<number, string, T> {
>SomeDerived : SomeDerived<T>
>T : T
>SomeBase : SomeBase<number, string, T>
>T : T
constructor() {
super<number, string, T> `hello world`;
>super<number, string, T> `hello world` : any
>super : any
>super : SomeBase<number, string, T>
> : any
>T : T
>`hello world` : "hello world"
}
}
@@ -0,0 +1,44 @@
Exit Code: 1
Standard output:
lib/adapters/http.js(12,19): error TS2307: Cannot find module './../../package.json'.
lib/adapters/http.js(83,22): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.
lib/adapters/http.js(189,23): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/adapters/http.js(195,44): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/adapters/http.js(201,13): error TS2322: Type 'string' is not assignable to type 'Buffer'.
lib/adapters/http.js(213,40): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/adapters/http.js(237,42): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/adapters/xhr.js(29,16): error TS2339: Property 'XDomainRequest' does not exist on type 'Window'.
lib/adapters/xhr.js(31,28): error TS2339: Property 'XDomainRequest' does not exist on type 'Window'.
lib/adapters/xhr.js(80,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'.
lib/adapters/xhr.js(92,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'.
lib/adapters/xhr.js(99,51): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/adapters/xhr.js(102,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'.
lib/adapters/xhr.js(111,7): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'.
lib/adapters/xhr.js(181,9): error TS2322: Type 'null' is not assignable to type 'XMLHttpRequest'.
lib/axios.js(23,3): error TS2554: Expected 3 arguments, but got 2.
lib/axios.js(25,3): error TS2322: Type '(...args: any[]) => any' is not assignable to type 'Axios'.
Property 'defaults' is missing in type '(...args: any[]) => any'.
lib/axios.js(32,7): error TS2339: Property 'Axios' does not exist on type 'Axios'.
lib/axios.js(35,7): error TS2339: Property 'create' does not exist on type 'Axios'.
lib/axios.js(40,7): error TS2339: Property 'Cancel' does not exist on type 'Axios'.
lib/axios.js(41,7): error TS2339: Property 'CancelToken' does not exist on type 'Axios'.
lib/axios.js(42,7): error TS2339: Property 'isCancel' does not exist on type 'Axios'.
lib/axios.js(45,7): error TS2339: Property 'all' does not exist on type 'Axios'.
lib/axios.js(48,7): error TS2339: Property 'spread' does not exist on type 'Axios'.
lib/cancel/CancelToken.js(37,12): error TS2339: Property 'reason' does not exist on type 'CancelToken'.
lib/cancel/CancelToken.js(38,16): error TS2339: Property 'reason' does not exist on type 'CancelToken'.
lib/core/enhanceError.js(14,9): error TS2339: Property 'config' does not exist on type 'Error'.
lib/core/enhanceError.js(16,11): error TS2339: Property 'code' does not exist on type 'Error'.
lib/core/enhanceError.js(18,9): error TS2339: Property 'request' does not exist on type 'Error'.
lib/core/enhanceError.js(19,9): error TS2339: Property 'response' does not exist on type 'Error'.
lib/core/settle.js(21,7): error TS2345: Argument of type 'null' is not assignable to parameter of type 'string | undefined'.
lib/helpers/btoa.js(11,13): error TS2339: Property 'code' does not exist on type 'Error'.
lib/helpers/btoa.js(31,13): error TS2532: Object is possibly 'undefined'.
lib/helpers/cookies.js(16,56): error TS2551: Property 'toGMTString' does not exist on type 'Date'. Did you mean 'toUTCString'?
lib/utils.js(244,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type.
lib/utils.js(268,20): error TS8029: JSDoc '@param' tag has name 'obj1', but there is no parameter with that name. It would match 'arguments' if it had an array type.
Standard error:
@@ -0,0 +1,20 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @noUnusedLocals: true
// @filename: file.ts
class Foo {
x: number;
}
declare global {
var module: any; // Just here to remove unrelated error from test
}
export = Foo;
// @filename: something.js
/** @typedef {typeof import("./file")} Foo */
/** @typedef {(foo: Foo) => string} FooFun */
module.exports = /** @type {FooFun} */(void 0);
@@ -0,0 +1,13 @@
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @filename: interfaces.d.ts
export interface Bar {
prop: string
}
// @filename: usage.js
/** @type {Bar} */
export let bar;
/** @typedef {import('./interfaces').Bar} Bar */
@@ -0,0 +1 @@
import {} from 'module-not-existed'
@@ -0,0 +1,47 @@
// @target: esnext
declare function f<T>(strs: TemplateStringsArray, ...callbacks: Array<(x: T) => any>): void;
interface Stuff {
x: number;
y: string;
z: boolean;
}
export const a = f<Stuff> `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
declare function g<Input, T, U, V>(
strs: TemplateStringsArray,
t: (i: Input) => T, u: (i: Input) => U, v: (i: Input) => V): T | U | V;
export const b = g<Stuff, number, string, boolean> `
hello
${stuff => stuff.x}
brave
${stuff => stuff.y}
world
${stuff => stuff.z}
`;
declare let obj: {
prop: <T>(strs: TemplateStringsArray, x: (input: T) => T) => {
returnedObjProp: T
}
}
export let c = obj["prop"]<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
c = obj.prop<Stuff> `${(input) => ({ ...input })}`
c.returnedObjProp.x;
c.returnedObjProp.y;
c.returnedObjProp.z;
@@ -0,0 +1,41 @@
// @target: esnext
// @strict: true
export interface SomethingTaggable {
<T>(t: TemplateStringsArray, ...args: T[]): SomethingNewable;
}
export interface SomethingNewable {
new <T>(...args: T[]): any;
}
declare const tag: SomethingTaggable;
const a = new tag `${100} ${200}`<string>("hello", "world");
const b = new tag<number> `${"hello"} ${"world"}`(100, 200);
const c = new tag<number> `${100} ${200}`<string>("hello", "world");
const d = new tag<number> `${"hello"} ${"world"}`<string>(100, 200);
/**
* Testing ASI. This should never parse as
*
* ```ts
* new tag<number>;
* `hello${369}`();
* ```
*/
const e = new tag<number>
`hello`();
class SomeBase<A, B, C> {
a!: A; b!: B; c!: C;
}
class SomeDerived<T> extends SomeBase<number, string, T> {
constructor() {
super<number, string, T> `hello world`;
}
}
@@ -0,0 +1,29 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: templateTagOnClasses.js
/**
* @template {T}
* @typedef {(t: T) => T} Id
*/
class Foo {
/** @typedef {(t: T) => T} Id2 */
/** @param {T} x */
constructor (x) {
this.a = x
}
/**
*
* @param {T} x
* @param {Id} y
* @param {Id2} alpha
* @return {T}
*/
foo(x, y, alpha) {
return alpha(y(x))
}
}
var f = new Foo(1)
var g = new Foo(false)
f.a = g.a
@@ -0,0 +1,26 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: templateTagOnConstructorFunctions.js
/**
* @template {T}
* @typedef {(t: T) => T} Id
* @param {T} t
*/
function Zet(t) {
/** @type {T} */
this.u
this.t = t
}
/**
* @param {T} v
* @param {Id} id
*/
Zet.prototype.add = function(v, id) {
this.u = v || this.t
return id(this.u)
}
var z = new Zet(1)
z.t = 2
z.u = false
@@ -10,7 +10,7 @@
verify.codeFixAll({
fixId: "forgottenThisPropertyAccess",
fixAllDescription: "Add 'this.' to all unresolved variables matching a member name",
fixAllDescription: "Add qualifier to all unresolved variables matching a member name",
newFileContent:
`class C {
foo: number;
@@ -0,0 +1,25 @@
/// <reference path='fourslash.ts' />
////class C {
//// static m() { m(); }
//// n() { m(); }
////}
verify.codeFix({
description: "Add 'C.' to unresolved variable",
index: 0,
newFileContent:
`class C {
static m() { C.m(); }
n() { m(); }
}`
});
verify.codeFix({
description: "Add 'C.' to unresolved variable",
newFileContent:
`class C {
static m() { C.m(); }
n() { C.m(); }
}`
});
@@ -3,15 +3,14 @@
// @allowJs: true
// @Filename: /a.js
// TODO: https://github.com/Microsoft/TypeScript/issues/16411
// Both uses of T should be referenced.
/////** @template [|{| "isWriteAccess": true, "isDefinition": true |}T|] */
////class C {
//// constructor() {
//// /** @type {T} */
//// /** @type {[|T|]} */
//// this.x = null;
//// }
////}
verify.singleReferenceGroup("(type parameter) T in C");
verify.singleReferenceGroup("(type parameter) T in C<T>", test.ranges());
@@ -16,5 +16,6 @@ const bGroup = { definition: "(alias) const x: 0\nimport x", ranges: bRanges };
verify.referenceGroups(aRanges, [aGroup, bGroup]);
verify.referenceGroups(bRanges, [bGroup]);
verify.rangesAreRenameLocations(aRanges);
verify.rangesAreRenameLocations(aRanges);
verify.renameLocations(r0, [r0, r1, r2, r3]);
verify.renameLocations(r1, [r0, r1, r2, r3]);
verify.rangesAreRenameLocations([r2, r3]);
@@ -0,0 +1,8 @@
/// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = 0;
////declare const a: typeof import("./a");
////a.[|x|];
verify.singleReferenceGroup("const x: 0");
+1 -1
View File
@@ -338,7 +338,7 @@ declare namespace FourSlashInterface {
verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: {
start: number;
length: number;
}, displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[], tags: ts.JSDocTagInfo[]): void;
}, displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[], tags: { name: string, text?: string }[]): void;
getSyntacticDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
getSemanticDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
getSuggestionDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
+51
View File
@@ -0,0 +1,51 @@
/// <reference path='fourslash.ts'/>
// @Filename: /a.ts
/////**
//// * Doc
//// * @tag Tag text
//// */
////export const x = 0;
// @Filename: /b.ts
////import { x } from "./a";
////x/*b*/;
// @Filename: /c.ts
/////**
//// * Doc 2
//// * @tag Tag text 2
//// */
////import {
//// /**
//// * Doc 3
//// * @tag Tag text 3
//// */
//// x
////} from "./a";
////x/*c*/;
goTo.eachMarker((_, index) => {
verify.verifyQuickInfoDisplayParts(
"alias",
"",
{ start: index === 0 ? 25 : 117, length: 1 },
[
{ text:"(",kind:"punctuation" },
{ text:"alias",kind:"text" },
{ text:")",kind:"punctuation" },
{ text:" ",kind:"space" },
{ text:"const",kind:"keyword" },
{ text:" ",kind:"space" },
{ text:"x",kind:"aliasName" },
{ text:":",kind:"punctuation" },
{ text:" ",kind:"space" },
{ text:"0",kind:"stringLiteral" },
{ text:"\n",kind:"lineBreak" },
{ text:"import",kind:"keyword" },
{ text:" ",kind:"space" },
{ text:"x",kind:"aliasName" },
],
[{ text: "Doc", kind: "text" }],
[{ name: "tag", text: "Tag text" }]);
});
@@ -1,4 +1,4 @@
/// <reference path="../fourslash.ts"/>
/// <reference path="./fourslash.ts"/>
////interface Foo {
//// /** Doc */
@@ -0,0 +1,11 @@
/// <reference path="./fourslash.ts"/>
////interface I { m(): void; }
////declare const o: { [K in keyof I]: number };
////o.m/*0*/;
////
////declare const p: { [K in keyof I]: I[K] };
////p.m/*1*/;
verify.quickInfoAt("0", "(property) m: number");
verify.quickInfoAt("1", "(method) m(): void");
@@ -0,0 +1,19 @@
/// <reference path='fourslash.ts' />
// @Filename: /a.ts
////export { default } from "./b";
////export { default as [|b|] } from "./b";
////export { default as bee } from "./b";
////import { default as [|b|] } from "./b";
////import { default as bee } from "./b";
////import [|b|] from "./b";
// @Filename: /b.ts
////const [|b|] = 0;
////export default [|b|];
const [r0, r1, r2, r3, r4] = test.ranges();
verify.renameLocations(r0, [r0]);
verify.renameLocations(r1, [r1]);
verify.renameLocations(r2, [r2]);
verify.renameLocations([r3, r4], [r0, r1, r2, r3, r4]);
+3
View File
@@ -0,0 +1,3 @@
{
"types": ["node"]
}
+14
View File
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"noImplicitAny": false,
"noImplicitThis": false,
"maxNodeModuleJsDepth": 0,
"strict": true,
"noEmit": true,
"allowJs": true,
"checkJs": true,
"types": ["node"],
"lib": ["esnext", "dom"],
},
"include": ["axios-src/lib"]
}