Merge branch 'master' into release-3.4

This commit is contained in:
Ryan Cavanaugh
2019-03-27 13:02:58 -07:00
132 changed files with 4814 additions and 1022 deletions
+45 -47
View File
@@ -15,8 +15,8 @@ type Command = {
description?: string;
};
const mailMapPath = path.resolve("../.mailmap");
const authorsPath = path.resolve("../AUTHORS.md");
const mailMapPath = path.resolve(__dirname, "../.mailmap");
const authorsPath = path.resolve(__dirname, "../AUTHORS.md");
function getKnownAuthors(): Author[] {
const segmentRegExp = /\s?([^<]+)\s+<([^>]+)>/g;
@@ -113,56 +113,54 @@ namespace Commands {
const cmd = "git shortlog -se " + specs.join(" ");
console.log(cmd);
const outputRegExp = /\d+\s+([^<]+)<([^>]+)>/;
const tty = process.platform === 'win32' ? 'CON' : '/dev/tty';
const authors: { name: string, email: string, knownAuthor?: Author }[] = [];
child_process.exec(`${cmd} < ${tty}`, { cwd: path.resolve("../") }, function (error, stdout, stderr) {
if (error) {
console.log(stderr.toString());
}
else {
const output = stdout.toString();
const lines = output.split("\n");
lines.forEach(line => {
if (line) {
let match: RegExpExecArray | null;
if (match = outputRegExp.exec(line)) {
authors.push({ name: match[1], email: match[2] });
}
else {
throw new Error("Could not parse output: " + line);
}
const {output: [error, stdout, stderr]} = child_process.spawnSync(`git`, ["shortlog", "-se", ...specs], { cwd: path.resolve(__dirname, "../") });
if (error) {
console.log(stderr.toString());
}
else {
const output = stdout.toString();
const lines = output.split("\n");
lines.forEach(line => {
if (line) {
let match: RegExpExecArray | null;
if (match = outputRegExp.exec(line)) {
authors.push({ name: match[1], email: match[2] });
}
else {
throw new Error("Could not parse output: " + line);
}
});
const maps = getKnownAuthorMaps();
const lookupAuthor = function ({name, email}: { name: string, email: string }) {
return maps.authorsByEmail[email.toLocaleLowerCase()] || maps.authorsByName[name];
};
const knownAuthors = authors
.map(lookupAuthor)
.filter(a => !!a)
.map(getAuthorName);
const unknownAuthors = authors
.filter(a => !lookupAuthor(a))
.map(a => `${a.name} <${a.email}>`);
if (knownAuthors.length) {
console.log("\r\n");
console.log("Found known authors: ");
console.log("=====================");
deduplicate(knownAuthors).sort(sortAuthors).forEach(log);
}
});
if (unknownAuthors.length) {
console.log("\r\n");
console.log("Found unknown authors: ");
console.log("=====================");
deduplicate(unknownAuthors).sort(sortAuthors).forEach(log);
}
const maps = getKnownAuthorMaps();
const lookupAuthor = function ({name, email}: { name: string, email: string }) {
return maps.authorsByEmail[email.toLocaleLowerCase()] || maps.authorsByName[name];
};
const knownAuthors = authors
.map(lookupAuthor)
.filter(a => !!a)
.map(getAuthorName);
const unknownAuthors = authors
.filter(a => !lookupAuthor(a))
.map(a => `${a.name} <${a.email}>`);
if (knownAuthors.length) {
console.log("\r\n");
console.log("Found known authors: ");
console.log("=====================");
deduplicate(knownAuthors).sort(sortAuthors).forEach(log);
}
});
if (unknownAuthors.length) {
console.log("\r\n");
console.log("Found unknown authors: ");
console.log("=====================");
deduplicate(unknownAuthors).sort(sortAuthors).forEach(log);
}
}
};
listAuthors.description = "List known and unknown authors for a given spec, e.g. 'node authors.js listAuthors origin/release-2.6..origin/release-2.7'";
}
+48
View File
@@ -0,0 +1,48 @@
// @ts-check
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const Octokit = require("@octokit/rest");
const fs = require("fs");
const requester = process.env.requesting_user;
const source = process.env.source_issue;
const postedComment = process.env.status_comment;
console.log(`Loading fragment from ${process.argv[3]}...`);
const outputTableText = fs.readFileSync(process.argv[3], { encoding: "utf8" });
console.log(`Fragment contents:
${outputTableText}`);
const gh = new Octokit();
gh.authenticate({
type: "token",
token: process.argv[2]
});
gh.issues.createComment({
number: +source,
owner: "Microsoft",
repo: "TypeScript",
body: `@${requester}
The results of the perf run you requested are in! Here they are:
${outputTableText}`
}).then(async data => {
console.log(`Results posted!`);
const newCommentUrl = data.data.html_url;
const comment = await gh.issues.getComment({
owner: "Microsoft",
repo: "TypeScript",
comment_id: +postedComment
});
const newBody = `${comment.data.body}
Update: [The results are in!](${newCommentUrl})`;
return await gh.issues.updateComment({
owner: "Microsoft",
repo: "TypeScript",
comment_id: +postedComment,
body: newBody
});
}).catch(e => {
console.error(e);
process.exit(1);
});
+1 -1
View File
@@ -230,7 +230,7 @@ namespace ts.BuilderState {
// Create the reference map, and set the file infos
for (const sourceFile of newProgram.getSourceFiles()) {
const version = sourceFile.version;
const version = Debug.assertDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
const oldInfo = useOldState ? oldState!.fileInfos.get(sourceFile.path) : undefined;
if (referencedMap) {
const newReferences = getReferencedFiles(newProgram, sourceFile, getCanonicalFileName);
+165 -146
View File
@@ -232,6 +232,7 @@ namespace ts {
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, agumentCount) =>
getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, CheckMode.IsForSignatureHelp),
getExpandedParameters,
hasEffectiveRestParameter,
getConstantValue: nodeIn => {
const node = getParseTreeNode(nodeIn, canHaveConstantValue);
return node ? getConstantValue(node) : undefined;
@@ -304,6 +305,8 @@ namespace ts {
getNeverType: () => neverType,
isSymbolAccessible,
getObjectFlags,
isArrayType,
isTupleType,
isArrayLikeType,
isTypeInvalidDueToUnionDiscriminant,
getAllPossiblePropertiesOfTypes,
@@ -388,7 +391,7 @@ namespace ts {
const intersectionTypes = createMap<IntersectionType>();
const literalTypes = createMap<LiteralType>();
const indexedAccessTypes = createMap<IndexedAccessType>();
const conditionalTypes = createMap<Type | undefined>();
const conditionalTypes = createMap<Type>();
const evolvingArrayTypes: EvolvingArrayType[] = [];
const undefinedProperties = createMap<Symbol>() as UnderscoreEscapedMap<Symbol>;
@@ -1471,7 +1474,14 @@ namespace ts {
// @y method(x, y) {} // <-- decorator y should be resolved at the class declaration, not the method.
// }
//
if (location.parent && isClassElement(location.parent)) {
// class Decorators are resolved outside of the class to avoid referencing type parameters of that class.
//
// type T = number;
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
if (location.parent && (isClassElement(location.parent) || location.parent.kind === SyntaxKind.ClassDeclaration)) {
location = location.parent;
}
break;
@@ -2342,19 +2352,12 @@ namespace ts {
}
if (moduleNotFoundError) {
// For relative paths, see if this was possibly a projectReference redirect
if (pathIsRelative(moduleReference)) {
const sourceFile = getSourceFileOfNode(location);
const redirects = sourceFile.redirectedReferences;
if (redirects) {
const normalizedTargetPath = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(sourceFile.fileName));
for (const ext of [Extension.Ts, Extension.Tsx]) {
const probePath = normalizedTargetPath + ext;
if (redirects.indexOf(probePath) >= 0) {
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, moduleReference, probePath);
return undefined;
}
}
// See if this was possibly a projectReference redirect
if (resolvedModule) {
const redirect = host.getProjectReferenceRedirect(resolvedModule.resolvedFileName);
if (redirect) {
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
return undefined;
}
}
@@ -3489,8 +3492,8 @@ namespace ts {
context.inferTypeParameters = (<ConditionalType>type).root.inferTypeParameters;
const extendsTypeNode = typeToTypeNodeHelper((<ConditionalType>type).extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
const trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(<ConditionalType>type), context);
const falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(<ConditionalType>type), context);
const trueTypeNode = typeToTypeNodeHelper((<ConditionalType>type).trueType, context);
const falseTypeNode = typeToTypeNodeHelper((<ConditionalType>type).falseType, context);
context.approximateLength += 15;
return createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -5471,9 +5474,6 @@ namespace ts {
}
return type;
}
if (declaration.kind === SyntaxKind.ExportAssignment) {
return widenTypeForVariableLikeDeclaration(checkExpressionCached((<ExportAssignment>declaration).expression), declaration);
}
// Handle variable, parameter or property
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
@@ -5484,7 +5484,10 @@ namespace ts {
return reportCircularityError(symbol);
}
let type: Type | undefined;
if (isInJSFile(declaration) &&
if (declaration.kind === SyntaxKind.ExportAssignment) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached((<ExportAssignment>declaration).expression), declaration);
}
else if (isInJSFile(declaration) &&
(isCallExpression(declaration) || isBinaryExpression(declaration) || isPropertyAccessExpression(declaration) && isBinaryExpression(declaration.parent))) {
type = getWidenedTypeFromAssignmentDeclaration(symbol);
}
@@ -7113,6 +7116,15 @@ namespace ts {
let stringIndexInfo: IndexInfo | undefined;
if (symbol.exports) {
members = getExportsOfSymbol(symbol);
if (symbol === globalThisSymbol) {
const varsOnly = createMap<Symbol>() as SymbolTable;
members.forEach(p => {
if (!(p.flags & SymbolFlags.BlockScoped)) {
varsOnly.set(p.escapedName, p);
}
});
members = varsOnly;
}
}
setStructuredTypeMembers(type, members, emptyArray, emptyArray, undefined, undefined);
if (symbol.flags & SymbolFlags.Class) {
@@ -7465,6 +7477,10 @@ namespace ts {
}
function getConstraintOfIndexedAccess(type: IndexedAccessType) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
function getConstraintFromIndexedAccess(type: IndexedAccessType) {
const objectType = getConstraintOfType(type.objectType) || type.objectType;
if (objectType !== type.objectType) {
const constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
@@ -7476,24 +7492,14 @@ namespace ts {
return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
}
function getDefaultConstraintOfTrueBranchOfConditionalType(root: ConditionalRoot, combinedMapper: TypeMapper | undefined, mapper: TypeMapper | undefined) {
const rootTrueType = root.trueType;
const rootTrueConstraint = !(rootTrueType.flags & TypeFlags.Substitution)
? rootTrueType
: instantiateType(((<SubstitutionType>rootTrueType).substitute), combinedMapper || mapper).flags & TypeFlags.AnyOrUnknown
? (<SubstitutionType>rootTrueType).typeVariable
: getIntersectionType([(<SubstitutionType>rootTrueType).substitute, (<SubstitutionType>rootTrueType).typeVariable]);
return instantiateType(rootTrueConstraint, combinedMapper || mapper);
}
function getDefaultConstraintOfConditionalType(type: ConditionalType) {
if (!type.resolvedDefaultConstraint) {
// An `any` branch of a conditional type would normally be viral - specifically, without special handling here,
// a conditional type with a single branch of type `any` would be assignable to anything, since it's constraint would simplify to
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
const trueConstraint = getDefaultConstraintOfTrueBranchOfConditionalType(type.root, type.combinedMapper, type.mapper);
const falseConstraint = getFalseTypeFromConditionalType(type);
const trueConstraint = getInferredTrueTypeFromConditionalType(type);
const falseConstraint = type.falseType;
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -7525,10 +7531,14 @@ namespace ts {
return undefined;
}
function getConstraintOfConditionalType(type: ConditionalType) {
function getConstraintFromConditionalType(type: ConditionalType) {
return getConstraintOfDistributiveConditionalType(type) || getDefaultConstraintOfConditionalType(type);
}
function getConstraintOfConditionalType(type: ConditionalType) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromConditionalType(type) : undefined;
}
function getUnionConstraintOfIntersection(type: IntersectionType, targetIsUnion: boolean) {
let constraints: Type[] | undefined;
let hasDisjointDomainType = false;
@@ -7605,7 +7615,7 @@ namespace ts {
if (!pushTypeResolution(t, TypeSystemPropertyName.ImmediateBaseConstraint)) {
return circularConstraintType;
}
if (constraintDepth === 50) {
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
// very high likelyhood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
@@ -7672,8 +7682,11 @@ namespace ts {
return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
}
if (t.flags & TypeFlags.Conditional) {
const constraint = getConstraintOfConditionalType(<ConditionalType>t);
return constraint && getBaseConstraint(constraint);
const constraint = getConstraintFromConditionalType(<ConditionalType>t);
constraintDepth++; // Penalize repeating conditional types (this captures the recursion within getConstraintFromConditionalType and carries it forward)
const result = constraint && getBaseConstraint(constraint);
constraintDepth--;
return result;
}
if (t.flags & TypeFlags.Substitution) {
return getBaseConstraint((<SubstitutionType>t).substitute);
@@ -7769,7 +7782,7 @@ namespace ts {
}
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined {
let props: Symbol[] | undefined;
const propSet = createMap<Symbol>();
let indexTypes: Type[] | undefined;
const isUnion = containingType.flags & TypeFlags.Union;
const excludeModifiers = isUnion ? ModifierFlags.NonPublicAccessibilityModifier : 0;
@@ -7784,7 +7797,10 @@ namespace ts {
const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
commonFlags &= prop.flags;
props = appendIfUnique(props, prop);
const id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? CheckFlags.Readonly : 0) |
(!(modifiers & ModifierFlags.NonPublicAccessibilityModifier) ? CheckFlags.ContainsPublic : 0) |
(modifiers & ModifierFlags.Protected ? CheckFlags.ContainsProtected : 0) |
@@ -7806,9 +7822,10 @@ namespace ts {
}
}
}
if (!props) {
if (!propSet.size) {
return undefined;
}
const props = arrayFrom(propSet.values());
if (props.length === 1 && !(checkFlags & CheckFlags.Partial) && !indexTypes) {
return props[0];
}
@@ -8298,7 +8315,7 @@ namespace ts {
}
}
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ?
createTypePredicateFromTypePredicateNode(type, signature.declaration!) :
createTypePredicateFromTypePredicateNode(type, signature) :
jsdocPredicate || noTypePredicate;
}
Debug.assert(!!signature.resolvedTypePredicate);
@@ -8306,13 +8323,13 @@ namespace ts {
return signature.resolvedTypePredicate === noTypePredicate ? undefined : signature.resolvedTypePredicate;
}
function createTypePredicateFromTypePredicateNode(node: TypePredicateNode, func: SignatureDeclaration | JSDocSignature): IdentifierTypePredicate | ThisTypePredicate {
function createTypePredicateFromTypePredicateNode(node: TypePredicateNode, signature: Signature): IdentifierTypePredicate | ThisTypePredicate {
const { parameterName } = node;
const type = getTypeFromTypeNode(node.type);
if (parameterName.kind === SyntaxKind.Identifier) {
return createIdentifierTypePredicate(
parameterName.escapedText as string,
getTypePredicateParameterIndex(func.parameters, parameterName),
findIndex(signature.parameters, p => p.escapedName === parameterName.escapedText),
type);
}
else {
@@ -8320,16 +8337,6 @@ namespace ts {
}
}
function getTypePredicateParameterIndex(parameterList: ReadonlyArray<ParameterDeclaration | JSDocParameterTag>, parameter: Identifier): number {
for (let i = 0; i < parameterList.length; i++) {
const param = parameterList[i];
if (param.name.kind === SyntaxKind.Identifier && param.name.escapedText === parameter.escapedText) {
return i;
}
}
return -1;
}
function getReturnTypeOfSignature(signature: Signature): Type {
if (!signature.resolvedReturnType) {
if (!pushTypeResolution(signature, TypeSystemPropertyName.ResolvedReturnType)) {
@@ -8860,6 +8867,9 @@ namespace ts {
}
function getSubstitutionType(typeVariable: TypeVariable, substitute: Type) {
if (substitute.flags & TypeFlags.AnyOrUnknown) {
return typeVariable;
}
const result = <SubstitutionType>createType(TypeFlags.Substitution);
result.typeVariable = typeVariable;
result.substitute = substitute;
@@ -9880,6 +9890,7 @@ namespace ts {
getNodeLinks(accessNode!).resolvedSymbol = prop;
}
}
const propType = getTypeOfSymbol(prop);
return accessExpression && getAssignmentTargetKind(accessExpression) !== AssignmentKind.Definite ?
getFlowTypeOfReference(accessExpression, propType) :
@@ -9923,7 +9934,10 @@ namespace ts {
return anyType;
}
if (accessExpression && !isConstEnumObjectType(objectType)) {
if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports!.has(propName) && (globalThisSymbol.exports!.get(propName)!.flags & SymbolFlags.BlockScoped)) {
error(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(propName), typeToString(objectType));
}
else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, Diagnostics.Property_0_is_a_static_member_of_type_1, propName as string, typeToString(objectType));
}
@@ -10138,24 +10152,11 @@ namespace ts {
const trueType = instantiateType(root.trueType, mapper);
const falseType = instantiateType(root.falseType, mapper);
const instantiationId = `${root.isDistributive ? "d" : ""}${getTypeId(checkType)}>${getTypeId(extendsType)}?${getTypeId(trueType)}:${getTypeId(falseType)}`;
if (conditionalTypes.has(instantiationId)) {
const result = conditionalTypes.get(instantiationId);
if (result !== undefined) {
return result;
}
// Somehow the conditional type depends on itself - usually via `infer` types in the `extends` clause
// paired with a (potentially deferred) circularly constrained type.
// The conditional _must_ be deferred.
const deferred = getDeferredConditionalType(root, mapper, /*combinedMapper*/ undefined, checkType, extendsType, trueType, falseType);
conditionalTypes.set(instantiationId, deferred);
return deferred;
const result = conditionalTypes.get(instantiationId);
if (result) {
return result;
}
conditionalTypes.set(instantiationId, undefined);
const newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
const cachedRecursiveResult = conditionalTypes.get(instantiationId);
if (cachedRecursiveResult) {
return cachedRecursiveResult;
}
conditionalTypes.set(instantiationId, newResult);
return newResult;
}
@@ -10164,7 +10165,7 @@ namespace ts {
// Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
if (falseType.flags & TypeFlags.Never && isTypeIdenticalTo(getActualTypeVariable(trueType), getActualTypeVariable(checkType))) {
if (checkType.flags & TypeFlags.Any || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
return getDefaultConstraintOfTrueBranchOfConditionalType(root, /*combinedMapper*/ undefined, mapper);
return trueType;
}
else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
return neverType;
@@ -10175,7 +10176,7 @@ namespace ts {
return neverType;
}
else if (checkType.flags & TypeFlags.Any || isIntersectionEmpty(checkType, extendsType)) { // Always false
return falseType; // TODO: Intersect negated `extends` type here
return falseType;
}
}
@@ -10230,21 +10231,15 @@ namespace ts {
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
if (!combinedMapper) {
result.resolvedTrueType = trueType;
result.resolvedFalseType = falseType;
}
result.trueType = trueType;
result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper!); // TODO: GH#18217
return result;
}
function getTrueTypeFromConditionalType(type: ConditionalType) {
return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
}
function getFalseTypeFromConditionalType(type: ConditionalType) {
return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
function getInferredTrueTypeFromConditionalType(type: ConditionalType) {
return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
}
function getInferTypeParameters(node: ConditionalTypeNode): TypeParameter[] | undefined {
@@ -11185,7 +11180,11 @@ namespace ts {
return getSubstitutionType(maybeVariable as TypeVariable, instantiateType((<SubstitutionType>type).substitute, mapper));
}
else {
return maybeVariable;
const sub = instantiateType((<SubstitutionType>type).substitute, mapper);
if (sub.flags & TypeFlags.AnyOrUnknown || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
}
}
return type;
@@ -11730,6 +11729,15 @@ namespace ts {
type ErrorReporter = (message: DiagnosticMessage, arg0?: string, arg1?: string) => void;
/**
* Returns true if `s` is `(...args: any[]) => any` or `(this: any, ...args: any[]) => any`
*/
function isAnySignature(s: Signature) {
return !s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 &&
s.hasRestParameter && (getTypeOfParameter(s.parameters[0]) === anyArrayType || isTypeAny(getTypeOfParameter(s.parameters[0]))) &&
isTypeAny(getReturnTypeOfSignature(s));
}
/**
* See signatureRelatedTo, compareSignaturesIdentical
*/
@@ -11745,6 +11753,10 @@ namespace ts {
return Ternary.True;
}
if (isAnySignature(target)) {
return Ternary.True;
}
const targetCount = getParameterCount(target);
if (!hasEffectiveRestParameter(target) && getMinArgumentCount(source) > targetCount) {
return Ternary.False;
@@ -11832,7 +11844,7 @@ namespace ts {
if (targetTypePredicate) {
const sourceTypePredicate = getTypePredicateOfSignature(source);
if (sourceTypePredicate) {
result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, source.declaration!, target.declaration!, reportErrors, errorReporter, compareTypes); // TODO: GH#18217
result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors, errorReporter, compareTypes);
}
else if (isIdentifierTypePredicate(targetTypePredicate)) {
if (reportErrors) {
@@ -11857,8 +11869,6 @@ namespace ts {
function compareTypePredicateRelatedTo(
source: TypePredicate,
target: TypePredicate,
sourceDeclaration: SignatureDeclaration | JSDocSignature,
targetDeclaration: SignatureDeclaration | JSDocSignature,
reportErrors: boolean,
errorReporter: ErrorReporter | undefined,
compareTypes: (s: Type, t: Type, reportErrors?: boolean) => Ternary): Ternary {
@@ -11871,12 +11881,9 @@ namespace ts {
}
if (source.kind === TypePredicateKind.Identifier) {
const targetPredicate = target as IdentifierTypePredicate;
const sourceIndex = source.parameterIndex - (getThisParameter(sourceDeclaration) ? 1 : 0);
const targetIndex = targetPredicate.parameterIndex - (getThisParameter(targetDeclaration) ? 1 : 0);
if (sourceIndex !== targetIndex) {
if (source.parameterIndex !== (target as IdentifierTypePredicate).parameterIndex) {
if (reportErrors) {
errorReporter!(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, targetPredicate.parameterName);
errorReporter!(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, source.parameterName, (target as IdentifierTypePredicate).parameterName);
errorReporter!(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target));
}
return Ternary.False;
@@ -12714,8 +12721,8 @@ namespace ts {
if ((<ConditionalType>source).root.isDistributive === (<ConditionalType>target).root.isDistributive) {
if (result = isRelatedTo((<ConditionalType>source).checkType, (<ConditionalType>target).checkType, /*reportErrors*/ false)) {
if (result &= isRelatedTo((<ConditionalType>source).extendsType, (<ConditionalType>target).extendsType, /*reportErrors*/ false)) {
if (result &= isRelatedTo(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target), /*reportErrors*/ false)) {
if (result &= isRelatedTo(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target), /*reportErrors*/ false)) {
if (result &= isRelatedTo((<ConditionalType>source).trueType, (<ConditionalType>target).trueType, /*reportErrors*/ false)) {
if (result &= isRelatedTo((<ConditionalType>source).falseType, (<ConditionalType>target).falseType, /*reportErrors*/ false)) {
return result;
}
}
@@ -12836,7 +12843,7 @@ namespace ts {
return result;
}
}
const constraint = getConstraintOfType(<TypeParameter>source);
const constraint = getConstraintOfType(<TypeVariable>source);
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
// A type variable with no constraint is not related to the non-primitive object type.
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
@@ -12868,8 +12875,8 @@ namespace ts {
// and Y1 is related to Y2.
if (isTypeIdenticalTo((<ConditionalType>source).extendsType, (<ConditionalType>target).extendsType) &&
(isRelatedTo((<ConditionalType>source).checkType, (<ConditionalType>target).checkType) || isRelatedTo((<ConditionalType>target).checkType, (<ConditionalType>source).checkType))) {
if (result = isRelatedTo(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target), reportErrors)) {
result &= isRelatedTo(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target), reportErrors);
if (result = isRelatedTo((<ConditionalType>source).trueType, (<ConditionalType>target).trueType, reportErrors)) {
result &= isRelatedTo((<ConditionalType>source).falseType, (<ConditionalType>target).falseType, reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -14283,7 +14290,7 @@ namespace ts {
}
}
function forEachMatchingParameterType(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) {
function applyToParameterTypes(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) {
const sourceCount = getParameterCount(source);
const targetCount = getParameterCount(target);
const sourceRestType = getEffectiveRestType(source);
@@ -14305,6 +14312,18 @@ namespace ts {
}
}
function applyToReturnTypes(source: Signature, target: Signature, callback: (s: Type, t: Type) => void) {
const sourceTypePredicate = getTypePredicateOfSignature(source);
const targetTypePredicate = getTypePredicateOfSignature(target);
if (sourceTypePredicate && targetTypePredicate && sourceTypePredicate.kind === targetTypePredicate.kind &&
(sourceTypePredicate.kind === TypePredicateKind.This || sourceTypePredicate.parameterIndex === (<IdentifierTypePredicate>targetTypePredicate).parameterIndex)) {
callback(sourceTypePredicate.type, targetTypePredicate.type);
}
else {
callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
}
}
function createInferenceContext(typeParameters: ReadonlyArray<TypeParameter>, signature: Signature | undefined, flags: InferenceFlags, compareTypes?: TypeComparer): InferenceContext {
return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable);
}
@@ -14523,10 +14542,9 @@ namespace ts {
emptyObjectType;
}
function inferTypes(inferences: InferenceInfo[], originalSource: Type, originalTarget: Type, priority: InferencePriority = 0) {
function inferTypes(inferences: InferenceInfo[], originalSource: Type, originalTarget: Type, priority: InferencePriority = 0, contravariant = false) {
let symbolStack: Symbol[];
let visited: Map<boolean>;
let contravariant = false;
let bivariant = false;
let propagationType: Type;
let allowComplexConstraintInference = true;
@@ -14617,9 +14635,11 @@ namespace ts {
const candidate = propagationType || source;
// We make contravariant inferences only if we are in a pure contravariant position,
// i.e. only if we have not descended into a bivariant position.
if (contravariant && !bivariant && !contains(inference.contraCandidates, candidate)) {
inference.contraCandidates = append(inference.contraCandidates, candidate);
inference.inferredType = undefined;
if (contravariant && !bivariant) {
if (!contains(inference.contraCandidates, candidate)) {
inference.contraCandidates = append(inference.contraCandidates, candidate);
inference.inferredType = undefined;
}
}
else if (!contains(inference.candidates, candidate)) {
inference.candidates = append(inference.candidates, candidate);
@@ -14691,12 +14711,12 @@ namespace ts {
else if (source.flags & TypeFlags.Conditional && target.flags & TypeFlags.Conditional) {
inferFromTypes((<ConditionalType>source).checkType, (<ConditionalType>target).checkType);
inferFromTypes((<ConditionalType>source).extendsType, (<ConditionalType>target).extendsType);
inferFromTypes(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target));
inferFromTypes(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target));
inferFromTypes((<ConditionalType>source).trueType, (<ConditionalType>target).trueType);
inferFromTypes((<ConditionalType>source).falseType, (<ConditionalType>target).falseType);
}
else if (target.flags & TypeFlags.Conditional && !contravariant) {
inferFromTypes(source, getTrueTypeFromConditionalType(<ConditionalType>target));
inferFromTypes(source, getFalseTypeFromConditionalType(<ConditionalType>target));
inferFromTypes(source, (<ConditionalType>target).trueType);
inferFromTypes(source, (<ConditionalType>target).falseType);
}
else if (target.flags & TypeFlags.UnionOrIntersection) {
for (const t of (<UnionOrIntersectionType>target).types) {
@@ -14924,17 +14944,10 @@ namespace ts {
const kind = target.declaration ? target.declaration.kind : SyntaxKind.Unknown;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
bivariant = bivariant || kind === SyntaxKind.MethodDeclaration || kind === SyntaxKind.MethodSignature || kind === SyntaxKind.Constructor;
forEachMatchingParameterType(source, target, inferFromContravariantTypes);
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
const sourceTypePredicate = getTypePredicateOfSignature(source);
const targetTypePredicate = getTypePredicateOfSignature(target);
if (sourceTypePredicate && targetTypePredicate && sourceTypePredicate.kind === targetTypePredicate.kind) {
inferFromTypes(sourceTypePredicate.type, targetTypePredicate.type);
}
else {
inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
}
applyToReturnTypes(source, target, inferFromTypes);
}
function inferFromIndexTypes(source: Type, target: Type) {
@@ -16600,7 +16613,7 @@ namespace ts {
}
if (isIdentifierTypePredicate(predicate)) {
const predicateArgument = callExpression.arguments[predicate.parameterIndex - (signature.thisParameter ? 1 : 0)];
const predicateArgument = callExpression.arguments[predicate.parameterIndex];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
@@ -19530,7 +19543,10 @@ namespace ts {
return anyType;
}
if (leftType.symbol === globalThisSymbol) {
if (noImplicitAny) {
if (globalThisSymbol.exports!.has(right.escapedText) && (globalThisSymbol.exports!.get(right.escapedText)!.flags & SymbolFlags.BlockScoped)) {
error(right, Diagnostics.Property_0_does_not_exist_on_type_1, unescapeLeadingUnderscores(right.escapedText), typeToString(leftType));
}
else if (noImplicitAny) {
error(right, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(leftType));
}
return anyType;
@@ -20170,18 +20186,14 @@ namespace ts {
const restType = getEffectiveRestType(contextualSignature);
const mapper = inferenceContext && (restType && restType.flags & TypeFlags.TypeParameter ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
forEachMatchingParameterType(sourceSignature, signature, (source, target) => {
applyToParameterTypes(sourceSignature, signature, (source, target) => {
// Type parameters from outer context referenced by source type are fixed by instantiation of the source type
inferTypes(context.inferences, source, target);
});
if (!inferenceContext) {
inferTypes(context.inferences, getReturnTypeOfSignature(contextualSignature), getReturnTypeOfSignature(signature), InferencePriority.ReturnType);
const signaturePredicate = getTypePredicateOfSignature(signature);
const contextualPredicate = getTypePredicateOfSignature(sourceSignature);
if (signaturePredicate && contextualPredicate && signaturePredicate.kind === contextualPredicate.kind &&
(signaturePredicate.kind === TypePredicateKind.This || signaturePredicate.parameterIndex === (contextualPredicate as IdentifierTypePredicate).parameterIndex)) {
inferTypes(context.inferences, contextualPredicate.type, signaturePredicate.type, InferencePriority.ReturnType);
}
applyToReturnTypes(contextualSignature, signature, (source, target) => {
inferTypes(context.inferences, source, target, InferencePriority.ReturnType);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
}
@@ -23520,23 +23532,30 @@ namespace ts {
// potentially add inferred type parameters to the outer function return type.
const returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
if (returnSignature && !returnSignature.typeParameters && !every(context.inferences, hasInferenceCandidates)) {
// Instantiate the expression type with its own type parameters as type arguments. This
// ensures that the type parameters are not erased to type any during type inference such
// that they can be inferred as actual types.
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
const uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
const strippedType = getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters));
// Infer from the stripped expression type to the contextual type starting with an empty
// set of inference candidates.
const instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters);
// Infer from the parameters of the instantiated signature to the parameters of the
// contextual signature starting with an empty set of inference candidates.
const inferences = map(context.inferences, info => createInferenceInfo(info.typeParameter));
inferTypes(inferences, strippedType, contextualType);
// If we produced some inference candidates and if the type parameters for which we produced
// candidates do not already have existing inferences, we adopt the new inference candidates and
// add the type parameters of the expression type to the set of inferred type parameters for
// the outer function return type.
if (some(inferences, hasInferenceCandidates) && !hasOverlappingInferences(context.inferences, inferences)) {
mergeInferences(context.inferences, inferences);
context.inferredTypeParameters = concatenate(context.inferredTypeParameters, uniqueTypeParameters);
return strippedType;
applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
inferTypes(inferences, source, target, /*priority*/ 0, /*contravariant*/ true);
});
if (some(inferences, hasInferenceCandidates)) {
// We have inference candidates, indicating that one or more type parameters are referenced
// in the parameter types of the contextual signature. Now also infer from the return type.
applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
inferTypes(inferences, source, target);
});
// If the type parameters for which we produced candidates do not have any inferences yet,
// we adopt the new inference candidates and add the type parameters of the expression type
// to the set of inferred type parameters for the outer function return type.
if (!hasOverlappingInferences(context.inferences, inferences)) {
mergeInferences(context.inferences, inferences);
context.inferredTypeParameters = concatenate(context.inferredTypeParameters, uniqueTypeParameters);
return getOrCreateTypeFromSignature(instantiatedSignature);
}
}
}
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
@@ -23880,7 +23899,8 @@ namespace ts {
return;
}
const typePredicate = getTypePredicateOfSignature(getSignatureFromDeclaration(parent));
const signature = getSignatureFromDeclaration(parent);
const typePredicate = getTypePredicateOfSignature(signature);
if (!typePredicate) {
return;
}
@@ -23893,14 +23913,13 @@ namespace ts {
}
else {
if (typePredicate.parameterIndex >= 0) {
if (parent.parameters[typePredicate.parameterIndex].dotDotDotToken) {
error(parameterName,
Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
if (signature.hasRestParameter && typePredicate.parameterIndex === signature.parameters.length - 1) {
error(parameterName, Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter);
}
else {
const leadingError = () => chainDiagnosticMessages(/*details*/ undefined, Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type);
checkTypeAssignableTo(typePredicate.type,
getTypeOfNode(parent.parameters[typePredicate.parameterIndex]),
getTypeOfSymbol(signature.parameters[typePredicate.parameterIndex]),
node.type,
/*headMessage*/ undefined,
leadingError);
@@ -27985,8 +28004,8 @@ namespace ts {
// The following checks only apply on a non-ambient instantiated module declaration.
if (symbol.flags & SymbolFlags.ValueModule
&& symbol.declarations.length > 1
&& !inAmbientContext
&& symbol.declarations.length > 1
&& isInstantiatedModule(node, !!compilerOptions.preserveConstEnums || !!compilerOptions.isolatedModules)) {
const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
if (firstNonAmbientClassOrFunc) {
+1 -7
View File
@@ -74,12 +74,7 @@ namespace ts {
// TODO(shkamat): update this after reworking ts build API
export function createCompilerHostWorker(options: CompilerOptions, setParentNodes?: boolean, system = sys): CompilerHost {
const existingDirectories = createMap<boolean>();
function getCanonicalFileName(fileName: string): string {
// if underlying system can distinguish between two files whose names differs only in cases then file name already in canonical form.
// otherwise use toLowerCase as a canonical form.
return system.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
}
const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames);
function getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile | undefined {
let text: string | undefined;
try {
@@ -2268,7 +2263,6 @@ namespace ts {
if (refFile) {
const redirect = getProjectReferenceRedirect(fileName);
if (redirect) {
((refFile.redirectedReferences || (refFile.redirectedReferences = [])) as string[]).push(fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
+19 -6
View File
@@ -690,9 +690,15 @@ namespace ts {
/* parameters */ [],
/* type */ undefined,
/* equalsGreaterThanToken */ undefined,
createPropertyAccess(
createSuper(),
name
setEmitFlags(
createPropertyAccess(
setEmitFlags(
createSuper(),
EmitFlags.NoSubstitution
),
name
),
EmitFlags.NoSubstitution
)
)
));
@@ -717,9 +723,16 @@ namespace ts {
/* type */ undefined,
/* equalsGreaterThanToken */ undefined,
createAssignment(
createPropertyAccess(
createSuper(),
name),
setEmitFlags(
createPropertyAccess(
setEmitFlags(
createSuper(),
EmitFlags.NoSubstitution
),
name
),
EmitFlags.NoSubstitution
),
createIdentifier("v")
)
)
+6 -3
View File
@@ -1338,11 +1338,14 @@ namespace ts {
let decorators: (ReadonlyArray<Decorator> | undefined)[] | undefined;
if (node) {
const parameters = node.parameters;
for (let i = 0; i < parameters.length; i++) {
const parameter = parameters[i];
const firstParameterIsThis = parameters.length > 0 && parameterIsThisKeyword(parameters[0]);
const firstParameterOffset = firstParameterIsThis ? 1 : 0;
const numParameters = firstParameterIsThis ? parameters.length - 1 : parameters.length;
for (let i = 0; i < numParameters; i++) {
const parameter = parameters[i + firstParameterOffset];
if (decorators || parameter.decorators) {
if (!decorators) {
decorators = new Array(parameters.length);
decorators = new Array(numParameters);
}
decorators[i] = parameter.decorators;
+22
View File
@@ -792,6 +792,15 @@ namespace ts {
newerInputFileName: newestInputFileName
};
}
else {
// Check tsconfig time
const configStatus = checkConfigFileUpToDateStatus(project.options.configFilePath!, oldestOutputFileTime, oldestOutputFileName);
if (configStatus) return configStatus;
// Check extended config time
const extendedConfigStatus = forEach(project.options.configFile!.extendedSourceFiles || emptyArray, configFile => checkConfigFileUpToDateStatus(configFile, oldestOutputFileTime, oldestOutputFileName));
if (extendedConfigStatus) return extendedConfigStatus;
}
if (!buildInfoChecked.hasKey(project.options.configFilePath as ResolvedConfigFileName)) {
buildInfoChecked.setValue(project.options.configFilePath as ResolvedConfigFileName, true);
@@ -828,6 +837,18 @@ namespace ts {
};
}
function checkConfigFileUpToDateStatus(configFile: string, oldestOutputFileTime: Date, oldestOutputFileName: string): Status.OutOfDateWithSelf | undefined {
// Check tsconfig time
const tsconfigTime = host.getModifiedTime(configFile) || missingFileModifiedTime;
if (oldestOutputFileTime < tsconfigTime) {
return {
type: UpToDateStatusType.OutOfDateWithSelf,
outOfDateOutputFileName: oldestOutputFileName,
newerInputFileName: configFile
};
}
}
function invalidateProject(configFileName: string, reloadLevel?: ConfigFileProgramReloadLevel) {
invalidateResolvedProject(resolveProjectName(configFileName), reloadLevel);
}
@@ -1178,6 +1199,7 @@ namespace ts {
}
function getOldProgram(proj: ResolvedConfigFileName, parsed: ParsedCommandLine) {
if (options.force) return undefined;
const value = builderPrograms.getValue(proj);
if (value) return value;
return readBuilderProgram(parsed.options, readFileWithCache) as any as T;
+8 -8
View File
@@ -2740,12 +2740,6 @@ namespace ts {
/* @internal */ resolvedModules?: Map<ResolvedModuleFull | undefined>;
/* @internal */ resolvedTypeReferenceDirectiveNames: Map<ResolvedTypeReferenceDirective | undefined>;
/* @internal */ imports: ReadonlyArray<StringLiteralLike>;
/**
* When a file's references are redirected due to project reference directives,
* the original names of the references are stored in this array
*/
/* @internal*/
redirectedReferences?: ReadonlyArray<string>;
// Identifier only if `declare global`
/* @internal */ moduleAugmentations: ReadonlyArray<StringLiteral | Identifier>;
/* @internal */ patternAmbientModules?: PatternAmbientModule[];
@@ -3074,6 +3068,7 @@ namespace ts {
getSourceFiles(): ReadonlyArray<SourceFile>;
getSourceFile(fileName: string): SourceFile | undefined;
getResolvedTypeReferenceDirectives(): ReadonlyMap<ResolvedTypeReferenceDirective | undefined>;
getProjectReferenceRedirect(fileName: string): string | undefined;
readonly redirectTargetsMap: RedirectTargetsMap;
}
@@ -3171,6 +3166,7 @@ namespace ts {
getResolvedSignature(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
/* @internal */ getResolvedSignatureForSignatureHelp(node: CallLikeExpression, candidatesOutArray?: Signature[], argumentCount?: number): Signature | undefined;
/* @internal */ getExpandedParameters(sig: Signature): ReadonlyArray<Symbol>;
/* @internal */ hasEffectiveRestParameter(sig: Signature): boolean;
getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature | undefined;
isImplementationOfOverload(node: SignatureDeclaration): boolean | undefined;
isUndefinedSymbol(symbol: Symbol): boolean;
@@ -3251,6 +3247,8 @@ namespace ts {
/* @internal */ getSymbolCount(): number;
/* @internal */ getTypeCount(): number;
/* @internal */ isArrayType(type: Type): boolean;
/* @internal */ isTupleType(type: Type): boolean;
/* @internal */ isArrayLikeType(type: Type): boolean;
/* @internal */ getObjectFlags(type: Type): ObjectFlags;
@@ -4312,8 +4310,10 @@ namespace ts {
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
resolvedTrueType?: Type;
resolvedFalseType?: Type;
trueType: Type;
falseType: Type;
/* @internal */
resolvedInferredTrueType?: Type; // The `trueType` instantiated with the `combinedMapper`, if present
/* @internal */
resolvedDefaultConstraint?: Type;
/* @internal */
+51 -1
View File
@@ -275,7 +275,7 @@ namespace ts {
}
}
export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: ProgramHost<any>) {
export function setGetSourceFileAsHashVersioned(compilerHost: CompilerHost, host: { createHash?(data: string): string; }) {
const originalGetSourceFile = compilerHost.getSourceFile;
const computeHash = host.createHash || generateDjb2Hash;
compilerHost.getSourceFile = (...args) => {
@@ -383,6 +383,56 @@ namespace ts {
if (!buildInfo.program) return undefined;
return createBuildProgramUsingProgramBuildInfo(buildInfo.program);
}
export function createIncrementalCompilerHost(options: CompilerOptions, system = sys): CompilerHost {
const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
host.createHash = maybeBind(system, system.createHash);
setGetSourceFileAsHashVersioned(host, system);
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
return host;
}
interface IncrementalProgramOptions<T extends BuilderProgram> {
rootNames: ReadonlyArray<string>;
options: CompilerOptions;
configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
projectReferences?: ReadonlyArray<ProjectReference>;
host?: CompilerHost;
createProgram?: CreateProgram<T>;
}
function createIncrementalProgram<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>({
rootNames, options, configFileParsingDiagnostics, projectReferences, host, createProgram
}: IncrementalProgramOptions<T>): T {
host = host || createIncrementalCompilerHost(options);
createProgram = createProgram || createEmitAndSemanticDiagnosticsBuilderProgram as any as CreateProgram<T>;
const oldProgram = readBuilderProgram(options, path => host!.readFile(path)) as any as T;
return createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
}
export interface IncrementalCompilationOptions {
rootNames: ReadonlyArray<string>;
options: CompilerOptions;
configFileParsingDiagnostics?: ReadonlyArray<Diagnostic>;
projectReferences?: ReadonlyArray<ProjectReference>;
host?: CompilerHost;
reportDiagnostic?: DiagnosticReporter;
reportErrorSummary?: ReportEmitErrorSummary;
afterProgramEmitAndDiagnostics?(program: EmitAndSemanticDiagnosticsBuilderProgram): void;
system?: System;
}
export function performIncrementalCompilation(input: IncrementalCompilationOptions) {
const system = input.system || sys;
const host = input.host || (input.host = createIncrementalCompilerHost(input.options, system));
const builderProgram = createIncrementalProgram(input);
const exitStatus = emitFilesAndReportErrors(
builderProgram,
input.reportDiagnostic || createDiagnosticReporter(system),
s => host.trace && host.trace(s),
input.reportErrorSummary || input.options.pretty ? errorCount => system.write(getErrorSummaryText(errorCount, system.newLine)) : undefined
);
if (input.afterProgramEmitAndDiagnostics) input.afterProgramEmitAndDiagnostics(builderProgram);
return exitStatus;
}
}
namespace ts {
+131 -59
View File
@@ -4425,7 +4425,7 @@ namespace FourSlashInterface {
}
export namespace Completion {
const functionEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "function", kindModifiers: "declare" });
const constEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "const", kindModifiers: "declare" });
const varEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "var", kindModifiers: "declare" });
const moduleEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "module", kindModifiers: "declare" });
const keywordEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "keyword" });
const methodEntry = (name: string): ExpectedCompletionEntryObject => ({ name, kind: "method", kindModifiers: "declare" });
@@ -4448,48 +4448,48 @@ namespace FourSlashInterface {
typeEntry("PropertyKey"),
interfaceEntry("PropertyDescriptor"),
interfaceEntry("PropertyDescriptorMap"),
constEntry("Object"),
varEntry("Object"),
interfaceEntry("ObjectConstructor"),
constEntry("Function"),
varEntry("Function"),
interfaceEntry("FunctionConstructor"),
typeEntry("ThisParameterType"),
typeEntry("OmitThisParameter"),
interfaceEntry("CallableFunction"),
interfaceEntry("NewableFunction"),
interfaceEntry("IArguments"),
constEntry("String"),
varEntry("String"),
interfaceEntry("StringConstructor"),
constEntry("Boolean"),
varEntry("Boolean"),
interfaceEntry("BooleanConstructor"),
constEntry("Number"),
varEntry("Number"),
interfaceEntry("NumberConstructor"),
interfaceEntry("TemplateStringsArray"),
interfaceEntry("ImportMeta"),
constEntry("Math"),
constEntry("Date"),
varEntry("Math"),
varEntry("Date"),
interfaceEntry("DateConstructor"),
interfaceEntry("RegExpMatchArray"),
interfaceEntry("RegExpExecArray"),
constEntry("RegExp"),
varEntry("RegExp"),
interfaceEntry("RegExpConstructor"),
constEntry("Error"),
varEntry("Error"),
interfaceEntry("ErrorConstructor"),
constEntry("EvalError"),
varEntry("EvalError"),
interfaceEntry("EvalErrorConstructor"),
constEntry("RangeError"),
varEntry("RangeError"),
interfaceEntry("RangeErrorConstructor"),
constEntry("ReferenceError"),
varEntry("ReferenceError"),
interfaceEntry("ReferenceErrorConstructor"),
constEntry("SyntaxError"),
varEntry("SyntaxError"),
interfaceEntry("SyntaxErrorConstructor"),
constEntry("TypeError"),
varEntry("TypeError"),
interfaceEntry("TypeErrorConstructor"),
constEntry("URIError"),
varEntry("URIError"),
interfaceEntry("URIErrorConstructor"),
constEntry("JSON"),
varEntry("JSON"),
interfaceEntry("ReadonlyArray"),
interfaceEntry("ConcatArray"),
constEntry("Array"),
varEntry("Array"),
interfaceEntry("ArrayConstructor"),
interfaceEntry("TypedPropertyDescriptor"),
typeEntry("ClassDecorator"),
@@ -4513,30 +4513,30 @@ namespace FourSlashInterface {
typeEntry("ReturnType"),
typeEntry("InstanceType"),
interfaceEntry("ThisType"),
constEntry("ArrayBuffer"),
varEntry("ArrayBuffer"),
interfaceEntry("ArrayBufferTypes"),
typeEntry("ArrayBufferLike"),
interfaceEntry("ArrayBufferConstructor"),
interfaceEntry("ArrayBufferView"),
constEntry("DataView"),
varEntry("DataView"),
interfaceEntry("DataViewConstructor"),
constEntry("Int8Array"),
varEntry("Int8Array"),
interfaceEntry("Int8ArrayConstructor"),
constEntry("Uint8Array"),
varEntry("Uint8Array"),
interfaceEntry("Uint8ArrayConstructor"),
constEntry("Uint8ClampedArray"),
varEntry("Uint8ClampedArray"),
interfaceEntry("Uint8ClampedArrayConstructor"),
constEntry("Int16Array"),
varEntry("Int16Array"),
interfaceEntry("Int16ArrayConstructor"),
constEntry("Uint16Array"),
varEntry("Uint16Array"),
interfaceEntry("Uint16ArrayConstructor"),
constEntry("Int32Array"),
varEntry("Int32Array"),
interfaceEntry("Int32ArrayConstructor"),
constEntry("Uint32Array"),
varEntry("Uint32Array"),
interfaceEntry("Uint32ArrayConstructor"),
constEntry("Float32Array"),
varEntry("Float32Array"),
interfaceEntry("Float32ArrayConstructor"),
constEntry("Float64Array"),
varEntry("Float64Array"),
interfaceEntry("Float64ArrayConstructor"),
moduleEntry("Intl"),
];
@@ -4552,9 +4552,47 @@ namespace FourSlashInterface {
];
}
function getInJsKeywords(keywords: ReadonlyArray<ExpectedCompletionEntryObject>): ReadonlyArray<ExpectedCompletionEntryObject> {
return keywords.filter(keyword => {
switch (keyword.name) {
case "enum":
case "interface":
case "implements":
case "private":
case "protected":
case "public":
case "abstract":
case "any":
case "boolean":
case "declare":
case "infer":
case "is":
case "keyof":
case "module":
case "namespace":
case "never":
case "readonly":
case "number":
case "object":
case "string":
case "symbol":
case "type":
case "unique":
case "unknown":
case "global":
case "bigint":
return false;
default:
return true;
}
});
}
export const classElementKeywords: ReadonlyArray<ExpectedCompletionEntryObject> =
["private", "protected", "public", "static", "abstract", "async", "constructor", "get", "readonly", "set"].map(keywordEntry);
export const classElementInJsKeywords = getInJsKeywords(classElementKeywords);
export const constructorParameterKeywords: ReadonlyArray<ExpectedCompletionEntryObject> =
["private", "protected", "public", "readonly"].map((name): ExpectedCompletionEntryObject => ({ name, kind: "keyword" }));
@@ -4692,6 +4730,8 @@ namespace FourSlashInterface {
}
});
export const statementInJsKeywords = getInJsKeywords(statementKeywords);
export const globalsVars: ReadonlyArray<ExpectedCompletionEntryObject> = [
functionEntry("eval"),
functionEntry("parseInt"),
@@ -4704,36 +4744,36 @@ namespace FourSlashInterface {
functionEntry("encodeURIComponent"),
functionEntry("escape"),
functionEntry("unescape"),
constEntry("NaN"),
constEntry("Infinity"),
constEntry("Object"),
constEntry("Function"),
constEntry("String"),
constEntry("Boolean"),
constEntry("Number"),
constEntry("Math"),
constEntry("Date"),
constEntry("RegExp"),
constEntry("Error"),
constEntry("EvalError"),
constEntry("RangeError"),
constEntry("ReferenceError"),
constEntry("SyntaxError"),
constEntry("TypeError"),
constEntry("URIError"),
constEntry("JSON"),
constEntry("Array"),
constEntry("ArrayBuffer"),
constEntry("DataView"),
constEntry("Int8Array"),
constEntry("Uint8Array"),
constEntry("Uint8ClampedArray"),
constEntry("Int16Array"),
constEntry("Uint16Array"),
constEntry("Int32Array"),
constEntry("Uint32Array"),
constEntry("Float32Array"),
constEntry("Float64Array"),
varEntry("NaN"),
varEntry("Infinity"),
varEntry("Object"),
varEntry("Function"),
varEntry("String"),
varEntry("Boolean"),
varEntry("Number"),
varEntry("Math"),
varEntry("Date"),
varEntry("RegExp"),
varEntry("Error"),
varEntry("EvalError"),
varEntry("RangeError"),
varEntry("ReferenceError"),
varEntry("SyntaxError"),
varEntry("TypeError"),
varEntry("URIError"),
varEntry("JSON"),
varEntry("Array"),
varEntry("ArrayBuffer"),
varEntry("DataView"),
varEntry("Int8Array"),
varEntry("Uint8Array"),
varEntry("Uint8ClampedArray"),
varEntry("Int16Array"),
varEntry("Uint16Array"),
varEntry("Int32Array"),
varEntry("Uint32Array"),
varEntry("Float32Array"),
varEntry("Float64Array"),
moduleEntry("Intl"),
];
@@ -4793,6 +4833,18 @@ namespace FourSlashInterface {
...globalKeywordsInsideFunction,
];
const globalInJsKeywordsInsideFunction = getInJsKeywords(globalKeywordsInsideFunction);
// TODO: many of these are inappropriate to always provide
export const globalsInJsInsideFunction = (plus: ReadonlyArray<ExpectedCompletionEntry>): ReadonlyArray<ExpectedCompletionEntry> => [
{ name: "arguments", kind: "local var" },
{ name: "globalThis", kind: "module" },
...globalsVars,
...plus,
{ name: "undefined", kind: "var" },
...globalInJsKeywordsInsideFunction,
];
// TODO: many of these are inappropriate to always provide
export const globalKeywords: ReadonlyArray<ExpectedCompletionEntryObject> = [
"break",
@@ -4871,6 +4923,8 @@ namespace FourSlashInterface {
"of",
].map(keywordEntry);
export const globalInJsKeywords = getInJsKeywords(globalKeywords);
export const insideMethodKeywords: ReadonlyArray<ExpectedCompletionEntryObject> = [
"break",
"case",
@@ -4917,6 +4971,8 @@ namespace FourSlashInterface {
"await",
].map(keywordEntry);
export const insideMethodInJsKeywords = getInJsKeywords(insideMethodKeywords);
export const globalKeywordsPlusUndefined: ReadonlyArray<ExpectedCompletionEntryObject> = (() => {
const i = ts.findIndex(globalKeywords, x => x.name === "unique");
return [...globalKeywords.slice(0, i), keywordEntry("undefined"), ...globalKeywords.slice(i)];
@@ -4929,6 +4985,13 @@ namespace FourSlashInterface {
...globalKeywords
];
export const globalsInJs: ReadonlyArray<ExpectedCompletionEntryObject> = [
{ name: "globalThis", kind: "module" },
...globalsVars,
{ name: "undefined", kind: "var" },
...globalInJsKeywords
];
export function globalsPlus(plus: ReadonlyArray<ExpectedCompletionEntry>): ReadonlyArray<ExpectedCompletionEntry> {
return [
{ name: "globalThis", kind: "module" },
@@ -4937,6 +5000,15 @@ namespace FourSlashInterface {
{ name: "undefined", kind: "var" },
...globalKeywords];
}
export function globalsInJsPlus(plus: ReadonlyArray<ExpectedCompletionEntry>): ReadonlyArray<ExpectedCompletionEntry> {
return [
{ name: "globalThis", kind: "module" },
...globalsVars,
...plus,
{ name: "undefined", kind: "var" },
...globalInJsKeywords];
}
}
export interface ReferenceGroup {
+30 -30
View File
@@ -2,8 +2,8 @@
/// ECMAScript APIs
/////////////////////////////
declare const NaN: number;
declare const Infinity: number;
declare var NaN: number;
declare var Infinity: number;
/**
* Evaluates JavaScript code and executes it.
@@ -244,7 +244,7 @@ interface ObjectConstructor {
/**
* Provides functionality common to all JavaScript objects.
*/
declare const Object: ObjectConstructor;
declare var Object: ObjectConstructor;
/**
* Creates a new function.
@@ -293,7 +293,7 @@ interface FunctionConstructor {
readonly prototype: Function;
}
declare const Function: FunctionConstructor;
declare var Function: FunctionConstructor;
/**
* Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
@@ -504,7 +504,7 @@ interface StringConstructor {
/**
* Allows manipulation and formatting of text strings and determination and location of substrings within strings.
*/
declare const String: StringConstructor;
declare var String: StringConstructor;
interface Boolean {
/** Returns the primitive value of the specified object. */
@@ -517,7 +517,7 @@ interface BooleanConstructor {
readonly prototype: Boolean;
}
declare const Boolean: BooleanConstructor;
declare var Boolean: BooleanConstructor;
interface Number {
/**
@@ -579,7 +579,7 @@ interface NumberConstructor {
}
/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
declare const Number: NumberConstructor;
declare var Number: NumberConstructor;
interface TemplateStringsArray extends ReadonlyArray<string> {
readonly raw: ReadonlyArray<string>;
@@ -703,7 +703,7 @@ interface Math {
tan(x: number): number;
}
/** An intrinsic object that provides basic mathematics functionality and constants. */
declare const Math: Math;
declare var Math: Math;
/** Enables basic storage and retrieval of dates and times. */
interface Date {
@@ -884,7 +884,7 @@ interface DateConstructor {
now(): number;
}
declare const Date: DateConstructor;
declare var Date: DateConstructor;
interface RegExpMatchArray extends Array<string> {
index?: number;
@@ -947,7 +947,7 @@ interface RegExpConstructor {
lastMatch: string;
}
declare const RegExp: RegExpConstructor;
declare var RegExp: RegExpConstructor;
interface Error {
name: string;
@@ -961,7 +961,7 @@ interface ErrorConstructor {
readonly prototype: Error;
}
declare const Error: ErrorConstructor;
declare var Error: ErrorConstructor;
interface EvalError extends Error {
}
@@ -972,7 +972,7 @@ interface EvalErrorConstructor {
readonly prototype: EvalError;
}
declare const EvalError: EvalErrorConstructor;
declare var EvalError: EvalErrorConstructor;
interface RangeError extends Error {
}
@@ -983,7 +983,7 @@ interface RangeErrorConstructor {
readonly prototype: RangeError;
}
declare const RangeError: RangeErrorConstructor;
declare var RangeError: RangeErrorConstructor;
interface ReferenceError extends Error {
}
@@ -994,7 +994,7 @@ interface ReferenceErrorConstructor {
readonly prototype: ReferenceError;
}
declare const ReferenceError: ReferenceErrorConstructor;
declare var ReferenceError: ReferenceErrorConstructor;
interface SyntaxError extends Error {
}
@@ -1005,7 +1005,7 @@ interface SyntaxErrorConstructor {
readonly prototype: SyntaxError;
}
declare const SyntaxError: SyntaxErrorConstructor;
declare var SyntaxError: SyntaxErrorConstructor;
interface TypeError extends Error {
}
@@ -1016,7 +1016,7 @@ interface TypeErrorConstructor {
readonly prototype: TypeError;
}
declare const TypeError: TypeErrorConstructor;
declare var TypeError: TypeErrorConstructor;
interface URIError extends Error {
}
@@ -1027,7 +1027,7 @@ interface URIErrorConstructor {
readonly prototype: URIError;
}
declare const URIError: URIErrorConstructor;
declare var URIError: URIErrorConstructor;
interface JSON {
/**
@@ -1056,7 +1056,7 @@ interface JSON {
/**
* An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
*/
declare const JSON: JSON;
declare var JSON: JSON;
/////////////////////////////
@@ -1345,7 +1345,7 @@ interface ArrayConstructor {
readonly prototype: Array<any>;
}
declare const Array: ArrayConstructor;
declare var Array: ArrayConstructor;
interface TypedPropertyDescriptor<T> {
enumerable?: boolean;
@@ -1504,7 +1504,7 @@ interface ArrayBufferConstructor {
new(byteLength: number): ArrayBuffer;
isView(arg: any): arg is ArrayBufferView;
}
declare const ArrayBuffer: ArrayBufferConstructor;
declare var ArrayBuffer: ArrayBufferConstructor;
interface ArrayBufferView {
/**
@@ -1654,7 +1654,7 @@ interface DataView {
interface DataViewConstructor {
new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;
}
declare const DataView: DataViewConstructor;
declare var DataView: DataViewConstructor;
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
@@ -1929,7 +1929,7 @@ interface Int8ArrayConstructor {
}
declare const Int8Array: Int8ArrayConstructor;
declare var Int8Array: Int8ArrayConstructor;
/**
* A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
@@ -2204,7 +2204,7 @@ interface Uint8ArrayConstructor {
from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array;
}
declare const Uint8Array: Uint8ArrayConstructor;
declare var Uint8Array: Uint8ArrayConstructor;
/**
* A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
@@ -2478,7 +2478,7 @@ interface Uint8ClampedArrayConstructor {
*/
from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray;
}
declare const Uint8ClampedArray: Uint8ClampedArrayConstructor;
declare var Uint8ClampedArray: Uint8ClampedArrayConstructor;
/**
* A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
@@ -2753,7 +2753,7 @@ interface Int16ArrayConstructor {
}
declare const Int16Array: Int16ArrayConstructor;
declare var Int16Array: Int16ArrayConstructor;
/**
* A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
@@ -3029,7 +3029,7 @@ interface Uint16ArrayConstructor {
}
declare const Uint16Array: Uint16ArrayConstructor;
declare var Uint16Array: Uint16ArrayConstructor;
/**
* A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
* requested number of bytes could not be allocated an exception is raised.
@@ -3303,7 +3303,7 @@ interface Int32ArrayConstructor {
from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array;
}
declare const Int32Array: Int32ArrayConstructor;
declare var Int32Array: Int32ArrayConstructor;
/**
* A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
@@ -3577,7 +3577,7 @@ interface Uint32ArrayConstructor {
from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array;
}
declare const Uint32Array: Uint32ArrayConstructor;
declare var Uint32Array: Uint32ArrayConstructor;
/**
* A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
@@ -3853,7 +3853,7 @@ interface Float32ArrayConstructor {
}
declare const Float32Array: Float32ArrayConstructor;
declare var Float32Array: Float32ArrayConstructor;
/**
* A typed array of 64-bit float values. The contents are initialized to 0. If the requested
@@ -4128,7 +4128,7 @@ interface Float64ArrayConstructor {
from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array;
}
declare const Float64Array: Float64ArrayConstructor;
declare var Float64Array: Float64ArrayConstructor;
/////////////////////////////
/// ECMAScript Internationalization API
+4 -4
View File
@@ -34,7 +34,7 @@ interface BigIntConstructor {
asUintN(bits: number, int: bigint): bigint;
}
declare const BigInt: BigIntConstructor;
declare var BigInt: BigIntConstructor;
/**
* A typed array of 64-bit signed integer values. The contents are initialized to 0. If the
@@ -303,7 +303,7 @@ interface BigInt64ArrayConstructor {
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigInt64Array;
}
declare const BigInt64Array: BigInt64ArrayConstructor;
declare var BigInt64Array: BigInt64ArrayConstructor;
/**
* A typed array of 64-bit unsigned integer values. The contents are initialized to 0. If the
@@ -572,7 +572,7 @@ interface BigUint64ArrayConstructor {
from<U>(arrayLike: ArrayLike<U>, mapfn: (v: U, k: number) => bigint, thisArg?: any): BigUint64Array;
}
declare const BigUint64Array: BigUint64ArrayConstructor;
declare var BigUint64Array: BigUint64ArrayConstructor;
interface DataView {
/**
@@ -606,4 +606,4 @@ interface DataView {
* otherwise a little-endian value should be written.
*/
setBigUint64(byteOffset: number, value: bigint, littleEndian?: boolean): void;
}
}
+24 -8
View File
@@ -659,16 +659,32 @@ namespace ts.server {
}
}
if (fileRequest && this.logger.hasLevel(LogLevel.verbose)) {
try {
const { file, project } = this.getFileAndProject(fileRequest);
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
if (scriptInfo) {
const text = getSnapshotText(scriptInfo.getSnapshot());
msg += `\n\nFile text of ${fileRequest.file}:${indent(text)}\n`;
if (this.logger.hasLevel(LogLevel.verbose)) {
if (fileRequest) {
try {
const { file, project } = this.getFileAndProject(fileRequest);
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
if (scriptInfo) {
const text = getSnapshotText(scriptInfo.getSnapshot());
msg += `\n\nFile text of ${fileRequest.file}:${indent(text)}\n`;
}
}
catch { } // tslint:disable-line no-empty
}
if (err.message && err.message.indexOf(`Could not find sourceFile:`) !== -1) {
msg += `\n\nProjects::\n`;
let counter = 0;
const addProjectInfo = (project: Project) => {
msg += `\nProject '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter}\n`;
msg += project.filesToString(/*writeProjectFileNames*/ true);
msg += "\n-----------------------------------------------\n";
counter++;
};
this.projectService.externalProjects.forEach(addProjectInfo);
this.projectService.configuredProjects.forEach(addProjectInfo);
this.projectService.inferredProjects.forEach(addProjectInfo);
}
catch {} // tslint:disable-line no-empty
}
this.logger.msg(msg, Msg.Err);
+69 -5
View File
@@ -30,6 +30,7 @@ namespace ts.Completions {
ConstructorParameterKeywords, // Keywords at constructor parameter
FunctionLikeBodyKeywords, // Keywords at function like body
TypeKeywords,
Last = TypeKeywords
}
const enum GlobalsSearch { Continue, Success, Fail }
@@ -77,7 +78,7 @@ namespace ts.Completions {
}
function completionInfoFromData(sourceFile: SourceFile, typeChecker: TypeChecker, compilerOptions: CompilerOptions, log: Log, completionData: CompletionData, preferences: UserPreferences): CompletionInfo | undefined {
const { symbols, completionKind, isInSnippetScope, isNewIdentifierLocation, location, propertyAccessToConvert, keywordFilters, literals, symbolToOriginInfoMap, recommendedCompletion, isJsxInitializer } = completionData;
const { symbols, completionKind, isInSnippetScope, isNewIdentifierLocation, location, propertyAccessToConvert, keywordFilters, literals, symbolToOriginInfoMap, recommendedCompletion, isJsxInitializer, insideJsDocTagTypeExpression } = completionData;
if (location && location.parent && isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
@@ -113,7 +114,7 @@ namespace ts.Completions {
if (keywordFilters !== KeywordCompletionFilters.None) {
const entryNames = arrayToSet(entries, e => e.name);
for (const keywordEntry of getKeywordCompletions(keywordFilters)) {
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
if (!entryNames.has(keywordEntry.name)) {
entries.push(keywordEntry);
}
@@ -510,6 +511,7 @@ namespace ts.Completions {
readonly recommendedCompletion: Symbol | undefined;
readonly previousToken: Node | undefined;
readonly isJsxInitializer: IsJsxInitializer;
readonly insideJsDocTagTypeExpression: boolean;
}
type Request = { readonly kind: CompletionDataKind.JsDocTagName | CompletionDataKind.JsDocTag } | { readonly kind: CompletionDataKind.JsDocParameterName, tag: JSDocParameterTag };
@@ -837,7 +839,22 @@ namespace ts.Completions {
const literals = mapDefined(contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]), t => t.isLiteral() ? t.value : undefined);
const recommendedCompletion = previousToken && contextualType && getRecommendedCompletion(previousToken, contextualType, typeChecker);
return { kind: CompletionDataKind.Data, symbols, completionKind, isInSnippetScope, propertyAccessToConvert, isNewIdentifierLocation, location, keywordFilters, literals, symbolToOriginInfoMap, recommendedCompletion, previousToken, isJsxInitializer };
return {
kind: CompletionDataKind.Data,
symbols,
completionKind,
isInSnippetScope,
propertyAccessToConvert,
isNewIdentifierLocation,
location,
keywordFilters,
literals,
symbolToOriginInfoMap,
recommendedCompletion,
previousToken,
isJsxInitializer,
insideJsDocTagTypeExpression
};
type JSDocTagWithTypeExpression = JSDocParameterTag | JSDocPropertyTag | JSDocReturnTag | JSDocTypeTag | JSDocTypedefTag;
@@ -890,7 +907,9 @@ namespace ts.Completions {
}
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation && symbol.declarations.some(d => d.kind !== SyntaxKind.SourceFile && d.kind !== SyntaxKind.ModuleDeclaration && d.kind !== SyntaxKind.EnumDeclaration)) {
if (!isTypeLocation &&
symbol.declarations &&
symbol.declarations.some(d => d.kind !== SyntaxKind.SourceFile && d.kind !== SyntaxKind.ModuleDeclaration && d.kind !== SyntaxKind.EnumDeclaration)) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}
@@ -1927,7 +1946,18 @@ namespace ts.Completions {
}
return res;
});
function getKeywordCompletions(keywordFilter: KeywordCompletionFilters): ReadonlyArray<CompletionEntry> {
function getKeywordCompletions(keywordFilter: KeywordCompletionFilters, filterOutTsOnlyKeywords: boolean): ReadonlyArray<CompletionEntry> {
if (!filterOutTsOnlyKeywords) return getTypescriptKeywordCompletions(keywordFilter);
const index = keywordFilter + KeywordCompletionFilters.Last + 1;
return _keywordCompletions[index] ||
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
.filter(entry => !isTypeScriptOnlyKeyword(stringToToken(entry.name)!))
);
}
function getTypescriptKeywordCompletions(keywordFilter: KeywordCompletionFilters): ReadonlyArray<CompletionEntry> {
return _keywordCompletions[keywordFilter] || (_keywordCompletions[keywordFilter] = allKeywordsCompletions().filter(entry => {
const kind = stringToToken(entry.name)!;
switch (keywordFilter) {
@@ -1952,6 +1982,40 @@ namespace ts.Completions {
}));
}
function isTypeScriptOnlyKeyword(kind: SyntaxKind) {
switch (kind) {
case SyntaxKind.AbstractKeyword:
case SyntaxKind.AnyKeyword:
case SyntaxKind.BigIntKeyword:
case SyntaxKind.BooleanKeyword:
case SyntaxKind.DeclareKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.GlobalKeyword:
case SyntaxKind.ImplementsKeyword:
case SyntaxKind.InferKeyword:
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.IsKeyword:
case SyntaxKind.KeyOfKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.NeverKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.PublicKeyword:
case SyntaxKind.ReadonlyKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.SymbolKeyword:
case SyntaxKind.TypeKeyword:
case SyntaxKind.UniqueKeyword:
case SyntaxKind.UnknownKeyword:
return true;
default:
return false;
}
}
function isInterfaceOrTypeLiteralCompletionKeyword(kind: SyntaxKind): boolean {
return kind === SyntaxKind.ReadonlyKeyword;
}
+58 -35
View File
@@ -586,25 +586,28 @@ namespace ts.FindAllReferences.Core {
}
else {
const search = state.createSearch(node, symbol, /*comingFrom*/ undefined, { allSearchSymbols: node ? populateSearchSymbolSet(symbol, node, checker, !!options.isForRename, !!options.providePrefixAndSuffixTextForRename, !!options.implementations) : [symbol] });
// Try to get the smallest valid scope that we can limit our search to;
// otherwise we'll need to search globally (i.e. include each file).
const scope = getSymbolScope(symbol);
if (scope) {
getReferencesInContainer(scope, scope.getSourceFile(), search, state, /*addReferencesHere*/ !(isSourceFile(scope) && !contains(sourceFiles, scope)));
}
else {
// Global search
for (const sourceFile of state.sourceFiles) {
state.cancellationToken.throwIfCancellationRequested();
searchForName(sourceFile, search, state);
}
}
getReferencesInContainerOrFiles(symbol, state, search);
}
return result;
}
function getReferencesInContainerOrFiles(symbol: Symbol, state: State, search: Search): void {
// Try to get the smallest valid scope that we can limit our search to;
// otherwise we'll need to search globally (i.e. include each file).
const scope = getSymbolScope(symbol);
if (scope) {
getReferencesInContainer(scope, scope.getSourceFile(), search, state, /*addReferencesHere*/ !(isSourceFile(scope) && !contains(state.sourceFiles, scope)));
}
else {
// Global search
for (const sourceFile of state.sourceFiles) {
state.cancellationToken.throwIfCancellationRequested();
searchForName(sourceFile, search, state);
}
}
}
function getSpecialSearchKind(node: Node): SpecialSearchKind {
switch (node.kind) {
case SyntaxKind.ConstructorKeyword:
@@ -707,7 +710,6 @@ namespace ts.FindAllReferences.Core {
constructor(
readonly sourceFiles: ReadonlyArray<SourceFile>,
readonly sourceFilesSet: ReadonlyMap<true>,
/** True if we're searching for constructor references. */
readonly specialSearchKind: SpecialSearchKind,
readonly checker: TypeChecker,
readonly cancellationToken: CancellationToken,
@@ -1293,6 +1295,7 @@ namespace ts.FindAllReferences.Core {
const classExtending = tryGetClassByExtendingIdentifier(referenceLocation);
if (classExtending) {
findSuperConstructorAccesses(classExtending, pusher());
findInheritedConstructorReferences(classExtending, state);
}
}
}
@@ -1325,35 +1328,44 @@ namespace ts.FindAllReferences.Core {
* Reference the constructor and all calls to `new this()`.
*/
function findOwnConstructorReferences(classSymbol: Symbol, sourceFile: SourceFile, addNode: (node: Node) => void): void {
for (const decl of classSymbol.members!.get(InternalSymbolName.Constructor)!.declarations) {
const ctrKeyword = findChildOfKind(decl, SyntaxKind.ConstructorKeyword, sourceFile)!;
Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword);
addNode(ctrKeyword);
const constructorSymbol = getClassConstructorSymbol(classSymbol);
if (constructorSymbol) {
for (const decl of constructorSymbol.declarations) {
const ctrKeyword = findChildOfKind(decl, SyntaxKind.ConstructorKeyword, sourceFile)!;
Debug.assert(decl.kind === SyntaxKind.Constructor && !!ctrKeyword);
addNode(ctrKeyword);
}
}
classSymbol.exports!.forEach(member => {
const decl = member.valueDeclaration;
if (decl && decl.kind === SyntaxKind.MethodDeclaration) {
const body = (<MethodDeclaration>decl).body;
if (body) {
forEachDescendantOfKind(body, SyntaxKind.ThisKeyword, thisKeyword => {
if (isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
});
if (classSymbol.exports) {
classSymbol.exports.forEach(member => {
const decl = member.valueDeclaration;
if (decl && decl.kind === SyntaxKind.MethodDeclaration) {
const body = (<MethodDeclaration>decl).body;
if (body) {
forEachDescendantOfKind(body, SyntaxKind.ThisKeyword, thisKeyword => {
if (isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
});
}
}
}
});
});
}
}
function getClassConstructorSymbol(classSymbol: Symbol): Symbol | undefined {
return classSymbol.members && classSymbol.members.get(InternalSymbolName.Constructor);
}
/** Find references to `super` in the constructor of an extending class. */
function findSuperConstructorAccesses(cls: ClassLikeDeclaration, addNode: (node: Node) => void): void {
const ctr = cls.symbol.members!.get(InternalSymbolName.Constructor);
if (!ctr) {
function findSuperConstructorAccesses(classDeclaration: ClassLikeDeclaration, addNode: (node: Node) => void): void {
const constructor = getClassConstructorSymbol(classDeclaration.symbol);
if (!constructor) {
return;
}
for (const decl of ctr.declarations) {
for (const decl of constructor.declarations) {
Debug.assert(decl.kind === SyntaxKind.Constructor);
const body = (<ConstructorDeclaration>decl).body;
if (body) {
@@ -1366,6 +1378,17 @@ namespace ts.FindAllReferences.Core {
}
}
function hasOwnConstructor(classDeclaration: ClassLikeDeclaration): boolean {
return !!getClassConstructorSymbol(classDeclaration.symbol);
}
function findInheritedConstructorReferences(classDeclaration: ClassLikeDeclaration, state: State): void {
if (hasOwnConstructor(classDeclaration)) return;
const classSymbol = classDeclaration.symbol;
const search = state.createSearch(/*location*/ undefined, classSymbol, /*comingFrom*/ undefined);
getReferencesInContainerOrFiles(classSymbol, state, search);
}
function addImplementationReferences(refNode: Node, addReference: (node: Node) => void, state: State): void {
// Check if we found a function/propertyAssignment/method with an implementation or initializer
if (isDeclarationName(refNode) && isImplementation(refNode.parent)) {
@@ -81,7 +81,7 @@ namespace ts.refactor.convertParamsToDestructuredObject {
const references = flatMap(names, /*mapfn*/ name => FindAllReferences.getReferenceEntriesForNode(-1, name, program, program.getSourceFiles(), cancellationToken));
const groupedReferences = groupReferences(references);
if (!every(groupedReferences.declarations, decl => contains(names, decl))) {
if (!every(groupedReferences.declarations, /*callback*/ decl => contains(names, decl))) {
groupedReferences.valid = false;
}
@@ -99,7 +99,19 @@ namespace ts.refactor.convertParamsToDestructuredObject {
groupedReferences.valid = false;
continue;
}
if (contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) {
/* We compare symbols because in some cases find all references wil return a reference that may or may not be to the refactored function.
Example from the refactorConvertParamsToDestructuredObject_methodCallUnion.ts test:
class A { foo(a: number, b: number) { return a + b; } }
class B { foo(c: number, d: number) { return c + d; } }
declare const ab: A | B;
ab.foo(1, 2);
Find all references will return `ab.foo(1, 2)` as a reference to A's `foo` but we could be calling B's `foo`.
When looking for constructor calls, however, the symbol on the constructor call reference is going to be the corresponding class symbol.
So we need to add a special case for this because when calling a constructor of a class through one of its subclasses,
the symbols are going to be different.
*/
if (contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || isNewExpressionTarget(entry.node)) {
const decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -233,6 +245,10 @@ namespace ts.refactor.convertParamsToDestructuredObject {
function getFunctionDeclarationAtPosition(file: SourceFile, startPosition: number, checker: TypeChecker): ValidFunctionDeclaration | undefined {
const node = getTouchingToken(file, startPosition);
const functionDeclaration = getContainingFunction(node);
// don't offer refactor on top-level JSDoc
if (isTopLevelJSDoc(node)) return undefined;
if (functionDeclaration
&& isValidFunctionDeclaration(functionDeclaration, checker)
&& rangeContainsRange(functionDeclaration, node)
@@ -241,18 +257,35 @@ namespace ts.refactor.convertParamsToDestructuredObject {
return undefined;
}
function isValidFunctionDeclaration(functionDeclaration: SignatureDeclaration, checker: TypeChecker): functionDeclaration is ValidFunctionDeclaration {
if (!isValidParameterNodeArray(functionDeclaration.parameters)) return false;
function isTopLevelJSDoc(node: Node): boolean {
const containingJSDoc = findAncestor(node, isJSDocNode);
if (containingJSDoc) {
const containingNonJSDoc = findAncestor(containingJSDoc, n => !isJSDocNode(n));
return !!containingNonJSDoc && isFunctionLikeDeclaration(containingNonJSDoc);
}
return false;
}
function isValidFunctionDeclaration(
functionDeclaration: SignatureDeclaration,
checker: TypeChecker): functionDeclaration is ValidFunctionDeclaration {
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false;
switch (functionDeclaration.kind) {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.MethodDeclaration:
return !!functionDeclaration.name && !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
return !!functionDeclaration.name
&& !!functionDeclaration.body
&& !checker.isImplementationOfOverload(functionDeclaration);
case SyntaxKind.Constructor:
if (isClassDeclaration(functionDeclaration.parent)) {
return !!functionDeclaration.body && !!functionDeclaration.parent.name && !checker.isImplementationOfOverload(functionDeclaration);
return !!functionDeclaration.body
&& !!functionDeclaration.parent.name
&& !checker.isImplementationOfOverload(functionDeclaration);
}
else {
return isValidVariableDeclaration(functionDeclaration.parent.parent) && !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
return isValidVariableDeclaration(functionDeclaration.parent.parent)
&& !!functionDeclaration.body
&& !checker.isImplementationOfOverload(functionDeclaration);
}
case SyntaxKind.FunctionExpression:
case SyntaxKind.ArrowFunction:
@@ -261,12 +294,21 @@ namespace ts.refactor.convertParamsToDestructuredObject {
return false;
}
function isValidParameterNodeArray(parameters: NodeArray<ParameterDeclaration>): parameters is ValidParameterNodeArray {
return getRefactorableParametersLength(parameters) >= minimumParameterLength && every(parameters, isValidParameterDeclaration);
function isValidParameterNodeArray(
parameters: NodeArray<ParameterDeclaration>,
checker: TypeChecker): parameters is ValidParameterNodeArray {
return getRefactorableParametersLength(parameters) >= minimumParameterLength
&& every(parameters, /*callback*/ paramDecl => isValidParameterDeclaration(paramDecl, checker));
}
function isValidParameterDeclaration(paramDeclaration: ParameterDeclaration): paramDeclaration is ValidParameterDeclaration {
return !paramDeclaration.modifiers && !paramDeclaration.decorators && isIdentifier(paramDeclaration.name);
function isValidParameterDeclaration(
parameterDeclaration: ParameterDeclaration,
checker: TypeChecker): parameterDeclaration is ValidParameterDeclaration {
if (isRestParameter(parameterDeclaration)) {
const type = checker.getTypeAtLocation(parameterDeclaration);
if (!checker.isArrayType(type) && !checker.isTupleType(type)) return false;
}
return !parameterDeclaration.modifiers && !parameterDeclaration.decorators && isIdentifier(parameterDeclaration.name);
}
function isValidVariableDeclaration(node: Node): node is ValidVariableDeclaration {
@@ -291,13 +333,23 @@ namespace ts.refactor.convertParamsToDestructuredObject {
return parameters;
}
function createPropertyOrShorthandAssignment(name: string, initializer: Expression): PropertyAssignment | ShorthandPropertyAssignment {
if (isIdentifier(initializer) && getTextOfIdentifierOrLiteral(initializer) === name) {
return createShorthandPropertyAssignment(name);
}
return createPropertyAssignment(name, initializer);
}
function createNewArgument(functionDeclaration: ValidFunctionDeclaration, functionArguments: NodeArray<Expression>): ObjectLiteralExpression {
const parameters = getRefactorableParameters(functionDeclaration.parameters);
const hasRestParameter = isRestParameter(last(parameters));
const nonRestArguments = hasRestParameter ? functionArguments.slice(0, parameters.length - 1) : functionArguments;
const properties = map(nonRestArguments, (arg, i) => {
const property = createPropertyAssignment(getParameterName(parameters[i]), arg);
suppressLeadingAndTrailingTrivia(property.initializer);
const parameterName = getParameterName(parameters[i]);
const property = createPropertyOrShorthandAssignment(parameterName, arg);
suppressLeadingAndTrailingTrivia(property.name);
if (isPropertyAssignment(property)) suppressLeadingAndTrailingTrivia(property.initializer);
copyComments(arg, property);
return property;
});
@@ -313,15 +365,15 @@ namespace ts.refactor.convertParamsToDestructuredObject {
}
function createNewParameters(functionDeclaration: ValidFunctionDeclaration, program: Program, host: LanguageServiceHost): NodeArray<ParameterDeclaration> {
const checker = program.getTypeChecker();
const refactorableParameters = getRefactorableParameters(functionDeclaration.parameters);
const bindingElements = map(refactorableParameters, createBindingElementFromParameterDeclaration);
const objectParameterName = createObjectBindingPattern(bindingElements);
const objectParameterType = createParameterTypeNode(refactorableParameters);
const checker = program.getTypeChecker();
let objectInitializer: Expression | undefined;
// If every parameter in the original function was optional, add an empty object initializer to the new object parameter
if (every(refactorableParameters, checker.isOptionalParameter)) {
if (every(refactorableParameters, isOptionalParameter)) {
objectInitializer = createObjectLiteral();
}
@@ -355,6 +407,20 @@ namespace ts.refactor.convertParamsToDestructuredObject {
}
return createNodeArray([objectParameter]);
function createBindingElementFromParameterDeclaration(parameterDeclaration: ValidParameterDeclaration): BindingElement {
const element = createBindingElement(
/*dotDotDotToken*/ undefined,
/*propertyName*/ undefined,
getParameterName(parameterDeclaration),
isRestParameter(parameterDeclaration) && isOptionalParameter(parameterDeclaration) ? createArrayLiteral() : parameterDeclaration.initializer);
suppressLeadingAndTrailingTrivia(element);
if (parameterDeclaration.initializer && element.initializer) {
copyComments(parameterDeclaration.initializer, element.initializer);
}
return element;
}
function createParameterTypeNode(parameters: NodeArray<ValidParameterDeclaration>): TypeLiteralNode {
const members = map(parameters, createPropertySignatureFromParameterDeclaration);
const typeNode = addEmitFlags(createTypeLiteralNode(members), EmitFlags.SingleLine);
@@ -370,7 +436,7 @@ namespace ts.refactor.convertParamsToDestructuredObject {
const propertySignature = createPropertySignature(
/*modifiers*/ undefined,
getParameterName(parameterDeclaration),
parameterDeclaration.initializer || isRestParameter(parameterDeclaration) ? createToken(SyntaxKind.QuestionToken) : parameterDeclaration.questionToken,
isOptionalParameter(parameterDeclaration) ? createToken(SyntaxKind.QuestionToken) : parameterDeclaration.questionToken,
parameterType,
/*initializer*/ undefined);
@@ -384,24 +450,17 @@ namespace ts.refactor.convertParamsToDestructuredObject {
}
function getTypeNode(node: Node): TypeNode | undefined {
const checker = program.getTypeChecker();
const type = checker.getTypeAtLocation(node);
return getTypeNodeIfAccessible(type, node, program, host);
}
}
function createBindingElementFromParameterDeclaration(parameterDeclaration: ValidParameterDeclaration): BindingElement {
const element = createBindingElement(
/*dotDotDotToken*/ undefined,
/*propertyName*/ undefined,
getParameterName(parameterDeclaration),
isRestParameter(parameterDeclaration) ? createArrayLiteral() : parameterDeclaration.initializer);
suppressLeadingAndTrailingTrivia(element);
if (parameterDeclaration.initializer && element.initializer) {
copyComments(parameterDeclaration.initializer, element.initializer);
function isOptionalParameter(parameterDeclaration: ValidParameterDeclaration): boolean {
if (isRestParameter(parameterDeclaration)) {
const type = checker.getTypeAtLocation(parameterDeclaration);
return !checker.isTupleType(type);
}
return checker.isOptionalParameter(parameterDeclaration);
}
return element;
}
function copyComments(sourceNode: Node, targetNode: Node) {
+1 -1
View File
@@ -1158,7 +1158,7 @@ namespace ts {
function getValidSourceFile(fileName: string): SourceFile {
const sourceFile = program.getSourceFile(fileName);
if (!sourceFile) {
throw new Error("Could not find file: '" + fileName + "'.");
throw new Error(`Could not find sourceFile: '${fileName}' in ${program && JSON.stringify(program.getSourceFiles().map(f => f.fileName))}.`);
}
return sourceFile;
}
+1 -1
View File
@@ -566,7 +566,7 @@ namespace ts.SignatureHelp {
}
function itemInfoForParameters(candidateSignature: Signature, checker: TypeChecker, enclosingDeclaration: Node, sourceFile: SourceFile): SignatureHelpItemInfo {
const isVariadic = candidateSignature.hasRestParameter;
const isVariadic = checker.hasEffectiveRestParameter(candidateSignature);
const printer = createPrinter({ removeComments: true });
const typeParameterParts = mapToDisplayParts(writer => {
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
@@ -284,6 +284,28 @@ namespace ts {
assertHasError("Issues a useful error", program.getSemanticDiagnostics(), Diagnostics.Output_file_0_has_not_been_built_from_source_file_1);
});
});
it("issues a nice error when the input file is missing when module reference is not relative", () => {
const spec: TestSpecification = {
"/alpha": {
files: { "/alpha/a.ts": "export const m: number = 3;" },
references: []
},
"/beta": {
files: { "/beta/b.ts": "import { m } from '@alpha/a'" },
references: ["../alpha"],
options: {
baseUrl: "./",
paths: {
"@alpha/*": ["/alpha/*"]
}
}
}
};
testProjectReferences(spec, "/beta/tsconfig.json", program => {
assertHasError("Issues a useful error", program.getSemanticDiagnostics(), Diagnostics.Output_file_0_has_not_been_built_from_source_file_1);
});
});
});
/**
+61 -2
View File
@@ -168,14 +168,14 @@ namespace ts {
});
describe("can detect when and what to rebuild", () => {
function initializeWithBuild() {
function initializeWithBuild(opts?: BuildOptions) {
const fs = projFs.shadow();
const host = new fakes.SolutionBuilderHost(fs);
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
builder.buildAllProjects();
host.clearDiagnostics();
tick();
builder.resetBuildContext();
builder.resetBuildContext(opts ? { ...opts, verbose: true } : undefined);
return { fs, host, builder };
}
@@ -254,6 +254,65 @@ namespace ts {
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
);
});
it("rebuilds from start if --f is passed", () => {
const { host, builder } = initializeWithBuild({ force: true });
builder.buildAllProjects();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/logic/tsconfig.json"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, "src/tests/tsconfig.json"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
);
});
it("rebuilds when tsconfig changes", () => {
const { fs, host, builder } = initializeWithBuild();
replaceText(fs, "/src/tests/tsconfig.json", `"composite": true`, `"composite": true, "target": "es3"`);
builder.buildAllProjects();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.json"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
[Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tests/tsconfig.json"]
);
});
it("rebuilds when extended config file changes", () => {
const fs = projFs.shadow();
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: { target: "es3" } }));
replaceText(fs, "/src/tests/tsconfig.json", `"references": [`, `"extends": "./tsconfig.base.json", "references": [`);
const host = new fakes.SolutionBuilderHost(fs);
const builder = createSolutionBuilder(host, ["/src/tests"], { verbose: true });
builder.buildAllProjects();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
);
host.clearDiagnostics();
tick();
builder.resetBuildContext();
fs.writeFileSync("/src/tests/tsconfig.base.json", JSON.stringify({ compilerOptions: {} }));
builder.buildAllProjects();
host.assertDiagnosticMessages(
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/logic/tsconfig.json", "src/logic/index.ts", "src/logic/index.js"],
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/tests/tsconfig.base.json"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
[Diagnostics.Updating_unchanged_output_timestamps_of_project_0, "/src/tests/tsconfig.json"]
);
});
});
describe("downstream-blocked compilations", () => {
+31 -11
View File
@@ -57,20 +57,23 @@ namespace ts.tscWatch {
function checkOutputErrors(
host: WatchedSystem,
logsBeforeWatchDiagnostic: string[] | undefined,
preErrorsWatchDiagnostic: Diagnostic,
preErrorsWatchDiagnostic: Diagnostic | undefined,
logsBeforeErrors: string[] | undefined,
errors: ReadonlyArray<Diagnostic> | ReadonlyArray<string>,
disableConsoleClears?: boolean | undefined,
...postErrorsWatchDiagnostics: Diagnostic[]
...postErrorsWatchDiagnostics: Diagnostic[] | string[]
) {
let screenClears = 0;
const outputs = host.getOutput();
const expectedOutputCount = 1 + errors.length + postErrorsWatchDiagnostics.length +
(logsBeforeWatchDiagnostic ? logsBeforeWatchDiagnostic.length : 0) + (logsBeforeErrors ? logsBeforeErrors.length : 0);
const expectedOutputCount = (preErrorsWatchDiagnostic ? 1 : 0) +
errors.length +
postErrorsWatchDiagnostics.length +
(logsBeforeWatchDiagnostic ? logsBeforeWatchDiagnostic.length : 0) +
(logsBeforeErrors ? logsBeforeErrors.length : 0);
assert.equal(outputs.length, expectedOutputCount, JSON.stringify(outputs));
let index = 0;
forEach(logsBeforeWatchDiagnostic, log => assertLog("logsBeforeWatchDiagnostic", log));
assertWatchDiagnostic(preErrorsWatchDiagnostic);
if (preErrorsWatchDiagnostic) assertWatchDiagnostic(preErrorsWatchDiagnostic);
forEach(logsBeforeErrors, log => assertLog("logBeforeError", log));
// Verify errors
forEach(errors, assertDiagnostic);
@@ -98,13 +101,18 @@ namespace ts.tscWatch {
index++;
}
function assertWatchDiagnostic(diagnostic: Diagnostic) {
const expected = getWatchDiagnosticWithoutDate(diagnostic);
if (!disableConsoleClears && contains(screenStartingMessageCodes, diagnostic.code)) {
assert.equal(host.screenClears[screenClears], index, `Expected screen clear at this diagnostic: ${expected}`);
screenClears++;
function assertWatchDiagnostic(diagnostic: Diagnostic | string) {
if (isString(diagnostic)) {
assert.equal(outputs[index], diagnostic, getOutputAtFailedMessage("Diagnostic", diagnostic));
}
else {
const expected = getWatchDiagnosticWithoutDate(diagnostic);
if (!disableConsoleClears && contains(screenStartingMessageCodes, diagnostic.code)) {
assert.equal(host.screenClears[screenClears], index, `Expected screen clear at this diagnostic: ${expected}`);
screenClears++;
}
assert.isTrue(endsWith(outputs[index], expected), getOutputAtFailedMessage("Watch diagnostic", expected));
}
assert.isTrue(endsWith(outputs[index], expected), getOutputAtFailedMessage("Watch diagnostic", expected));
index++;
}
@@ -159,6 +167,18 @@ namespace ts.tscWatch {
assert.equal(host.exitCode, expectedExitCode);
}
export function checkNormalBuildErrors(host: WatchedSystem, errors: ReadonlyArray<Diagnostic> | ReadonlyArray<string>, reportErrorSummary?: boolean) {
checkOutputErrors(
host,
/*logsBeforeWatchDiagnostic*/ undefined,
/*preErrorsWatchDiagnostic*/ undefined,
/*logsBeforeErrors*/ undefined,
errors,
/*disableConsoleClears*/ undefined,
...(reportErrorSummary ? [getErrorSummaryText(errors.length, host.newLine)] : emptyArray)
);
}
function isDiagnosticMessageChain(message: DiagnosticMessage | DiagnosticMessageChain): message is DiagnosticMessageChain {
return !!(message as DiagnosticMessageChain).messageText;
}
@@ -15,9 +15,51 @@ namespace ts.tscWatch {
expectedIncrementalEmit?: ReadonlyArray<File>;
expectedIncrementalErrors?: ReadonlyArray<string>;
}
function verifyIncrementalWatchEmit({
files, expectedInitialEmit, expectedInitialErrors, modifyFs, expectedIncrementalEmit, expectedIncrementalErrors
}: VerifyIncrementalWatchEmitInput) {
function verifyIncrementalWatchEmit(input: VerifyIncrementalWatchEmitInput) {
it("with tsc --w", () => {
verifyIncrementalWatchEmitWorker({
input,
emitAndReportErrors: createWatchOfConfigFile,
verifyErrors: checkOutputErrorsInitial
});
});
it("with tsc", () => {
verifyIncrementalWatchEmitWorker({
input,
emitAndReportErrors: incrementalBuild,
verifyErrors: checkNormalBuildErrors
});
});
}
function incrementalBuild(configFile: string, host: WatchedSystem) {
const reportDiagnostic = createDiagnosticReporter(host);
const config = parseConfigFileWithSystem(configFile, {}, host, reportDiagnostic);
if (config) {
performIncrementalCompilation({
rootNames: config.fileNames,
options: config.options,
projectReferences: config.projectReferences,
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
reportDiagnostic,
system: host
});
}
return { close: noop };
}
interface VerifyIncrementalWatchEmitWorkerInput {
input: VerifyIncrementalWatchEmitInput;
emitAndReportErrors: (configFile: string, host: WatchedSystem) => { close(): void; };
verifyErrors: (host: WatchedSystem, errors: ReadonlyArray<string>) => void;
}
function verifyIncrementalWatchEmitWorker({
input: {
files, expectedInitialEmit, expectedInitialErrors, modifyFs, expectedIncrementalEmit, expectedIncrementalErrors
},
emitAndReportErrors,
verifyErrors
}: VerifyIncrementalWatchEmitWorkerInput) {
const host = createWatchedSystem(files, { currentDirectory: project });
const originalWriteFile = host.writeFile;
const writtenFiles = createMap<string>();
@@ -26,19 +68,41 @@ namespace ts.tscWatch {
writtenFiles.set(path, content);
originalWriteFile.call(host, path, content);
};
verifyWatch(host, writtenFiles, expectedInitialEmit, expectedInitialErrors);
verifyBuild({
host,
writtenFiles,
emitAndReportErrors,
verifyErrors,
expectedEmit: expectedInitialEmit,
expectedErrors: expectedInitialErrors
});
if (modifyFs) {
modifyFs(host);
verifyWatch(host, writtenFiles, Debug.assertDefined(expectedIncrementalEmit), Debug.assertDefined(expectedIncrementalErrors));
verifyBuild({
host,
writtenFiles,
emitAndReportErrors,
verifyErrors,
expectedEmit: Debug.assertDefined(expectedIncrementalEmit),
expectedErrors: Debug.assertDefined(expectedIncrementalErrors)
});
}
}
function verifyWatch(host: WatchedSystem, writtenFiles: Map<string>, expectedEmit: ReadonlyArray<File>, expectedErrors: ReadonlyArray<string>) {
interface VerifyBuildWorker {
host: WatchedSystem;
writtenFiles: Map<string>;
emitAndReportErrors: VerifyIncrementalWatchEmitWorkerInput["emitAndReportErrors"];
verifyErrors: VerifyIncrementalWatchEmitWorkerInput["verifyErrors"];
expectedEmit: ReadonlyArray<File>;
expectedErrors: ReadonlyArray<string>;
}
function verifyBuild({ host, writtenFiles, emitAndReportErrors, verifyErrors, expectedEmit, expectedErrors }: VerifyBuildWorker) {
writtenFiles.clear();
const watch = createWatchOfConfigFile("tsconfig.json", host);
const result = emitAndReportErrors("tsconfig.json", host);
checkFileEmit(writtenFiles, expectedEmit);
checkOutputErrorsInitial(host, expectedErrors);
watch.close();
verifyErrors(host, expectedErrors);
result.close();
}
function checkFileEmit(actual: Map<string>, expected: ReadonlyArray<File>) {
@@ -73,7 +137,7 @@ namespace ts.tscWatch {
content: "var y = 20;\n"
};
it("own file emit without errors", () => {
describe("own file emit without errors", () => {
const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10");
verifyIncrementalWatchEmit({
files: [libFile, file1, file2, configFile],
@@ -125,7 +189,7 @@ namespace ts.tscWatch {
});
});
it("own file emit with errors", () => {
describe("own file emit with errors", () => {
const fileModified: File = {
path: file2.path,
content: `const y: string = 20;`
@@ -208,7 +272,7 @@ namespace ts.tscWatch {
});
});
it("with --out", () => {
describe("with --out", () => {
const config: File = {
path: configFile.path,
content: JSON.stringify({ compilerOptions: { incremental: true, outFile: "out.js" } })
@@ -279,7 +343,7 @@ namespace ts.tscWatch {
content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd" } })
};
it("own file emit without errors", () => {
describe("own file emit without errors", () => {
const modifiedFile2Content = file2.content.replace("y", "z").replace("20", "10");
verifyIncrementalWatchEmit({
files: [libFile, file1, file2, config],
@@ -330,7 +394,7 @@ namespace ts.tscWatch {
});
});
it("own file emit with errors", () => {
describe("own file emit with errors", () => {
const fileModified: File = {
path: file2.path,
content: `export const y: string = 20;`
@@ -412,7 +476,7 @@ namespace ts.tscWatch {
});
});
it("with --out", () => {
describe("with --out", () => {
const config: File = {
path: configFile.path,
content: JSON.stringify({ compilerOptions: { incremental: true, module: "amd", outFile: "out.js" } })
@@ -139,7 +139,7 @@ namespace ts.projectSystem {
assert.isTrue(false, `should not find file '${imported.path}'`);
}
catch (e) {
assert.isTrue(e.message.indexOf(`Could not find file: '${imported.path}'.`) === 0);
assert.isTrue(e.message.indexOf(`Could not find sourceFile: '${imported.path}' in ["${root.path}"].`) === 0, `Actual: ${e.message}`);
}
const f2Lookups = getLocationsForModuleLookup("f2");
callsTrackingHost.verifyCalledOnEachEntryNTimes(CalledMapsWithSingleArg.fileExists, f2Lookups, 1);
+11 -35
View File
@@ -13,7 +13,7 @@ namespace ts {
}
let reportDiagnostic = createDiagnosticReporter(sys);
function updateReportDiagnostic(options?: CompilerOptions) {
function updateReportDiagnostic(options: CompilerOptions | BuildOptions) {
if (shouldBePretty(options)) {
reportDiagnostic = createDiagnosticReporter(sys, /*pretty*/ true);
}
@@ -23,7 +23,7 @@ namespace ts {
return !!sys.writeOutputIsTTY && sys.writeOutputIsTTY();
}
function shouldBePretty(options?: CompilerOptions) {
function shouldBePretty(options: CompilerOptions | BuildOptions) {
if (!options || typeof options.pretty === "undefined") {
return defaultIsPretty();
}
@@ -192,7 +192,7 @@ namespace ts {
}
// Update to pretty if host supports it
updateReportDiagnostic();
updateReportDiagnostic(buildOptions);
if (projects.length === 0) {
printVersion();
printHelp(buildOpts, "--build ");
@@ -209,8 +209,8 @@ namespace ts {
// Use default createProgram
const buildHost = buildOptions.watch ?
createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty()), createWatchStatusReporter()) :
createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty()), createReportErrorSummary(buildOptions));
createSolutionBuilderWithWatchHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createWatchStatusReporter(buildOptions)) :
createSolutionBuilderHost(sys, /*createProgram*/ undefined, reportDiagnostic, createBuilderStatusReporter(sys, shouldBePretty(buildOptions)), createReportErrorSummary(buildOptions));
updateCreateProgram(buildHost);
buildHost.afterProgramEmitAndDiagnostics = (program: BuilderProgram) => reportStatistics(program.getProgram());
@@ -260,40 +260,16 @@ namespace ts {
function performIncrementalCompilation(config: ParsedCommandLine) {
const { options, fileNames, projectReferences } = config;
const host = createCompilerHost(options);
const currentDirectory = host.getCurrentDirectory();
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
changeCompilerHostLikeToUseCache(host, fileName => toPath(fileName, currentDirectory, getCanonicalFileName));
enableStatistics(options);
const oldProgram = readBuilderProgram(options, path => host.readFile(path));
const configFileParsingDiagnostics = getConfigFileParsingDiagnostics(config);
const programOptions: CreateProgramOptions = {
return sys.exit(ts.performIncrementalCompilation({
rootNames: fileNames,
options,
projectReferences,
host,
configFileParsingDiagnostics: getConfigFileParsingDiagnostics(config),
};
const program = createProgram(programOptions);
const builderProgram = createEmitAndSemanticDiagnosticsBuilderProgram(
program,
{
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
createHash: maybeBind(sys, sys.createHash),
writeFile: (path, data, writeByteOrderMark) => sys.writeFile(path, data, writeByteOrderMark)
},
oldProgram,
configFileParsingDiagnostics
);
const exitStatus = emitFilesAndReportErrors(
builderProgram,
projectReferences,
reportDiagnostic,
s => sys.write(s + sys.newLine),
createReportErrorSummary(options)
);
reportStatistics(program);
return sys.exit(exitStatus);
reportErrorSummary: createReportErrorSummary(options),
afterProgramEmitAndDiagnostics: builderProgram => reportStatistics(builderProgram.getProgram())
}));
}
function updateCreateProgram<T extends BuilderProgram>(host: { createProgram: CreateProgram<T>; }) {
@@ -316,7 +292,7 @@ namespace ts {
};
}
function createWatchStatusReporter(options?: CompilerOptions) {
function createWatchStatusReporter(options: CompilerOptions | BuildOptions) {
return ts.createWatchStatusReporter(sys, shouldBePretty(options));
}
+2 -2
View File
@@ -2382,8 +2382,8 @@ declare namespace ts {
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
resolvedTrueType?: Type;
resolvedFalseType?: Type;
trueType: Type;
falseType: Type;
}
interface SubstitutionType extends InstantiableType {
typeVariable: TypeVariable;
+2 -2
View File
@@ -2382,8 +2382,8 @@ declare namespace ts {
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
resolvedTrueType?: Type;
resolvedFalseType?: Type;
trueType: Type;
falseType: Type;
}
interface SubstitutionType extends InstantiableType {
typeVariable: TypeVariable;
@@ -124,6 +124,66 @@ class B extends A {
// element access (assign) in async arrow
(async () => super["x"] = f);
}
async * property_access_only_read_only_in_generator() {
// call with property access
super.x();
// property access (read)
const a = super.x;
// property access in arrow
(() => super.x());
// property access in async arrow
(async () => super.x());
}
async * property_access_only_write_only_in_generator() {
const f = () => {};
// property access (assign)
super.x = f;
// destructuring assign with property access
({ f: super.x } = { f });
// property access (assign) in arrow
(() => super.x = f);
// property access (assign) in async arrow
(async () => super.x = f);
}
async * element_access_only_read_only_in_generator() {
// call with element access
super["x"]();
// element access (read)
const a = super["x"];
// element access in arrow
(() => super["x"]());
// element access in async arrow
(async () => super["x"]());
}
async * element_access_only_write_only_in_generator() {
const f = () => {};
// element access (assign)
super["x"] = f;
// destructuring assign with element access
({ f: super["x"] } = { f });
// element access (assign) in arrow
(() => super["x"] = f);
// element access (assign) in async arrow
(async () => super["x"] = f);
}
}
@@ -253,4 +313,67 @@ class B extends A {
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; }));
});
}
property_access_only_read_only_in_generator() {
const _super = Object.create(null, {
x: { get: () => super.x }
});
return __asyncGenerator(this, arguments, function* property_access_only_read_only_in_generator_1() {
// call with property access
_super.x.call(this);
// property access (read)
const a = _super.x;
// property access in arrow
(() => _super.x.call(this));
// property access in async arrow
(() => __awaiter(this, void 0, void 0, function* () { return _super.x.call(this); }));
});
}
property_access_only_write_only_in_generator() {
const _super = Object.create(null, {
x: { get: () => super.x, set: v => super.x = v }
});
return __asyncGenerator(this, arguments, function* property_access_only_write_only_in_generator_1() {
const f = () => { };
// property access (assign)
_super.x = f;
// destructuring assign with property access
({ f: _super.x } = { f });
// property access (assign) in arrow
(() => _super.x = f);
// property access (assign) in async arrow
(() => __awaiter(this, void 0, void 0, function* () { return _super.x = f; }));
});
}
element_access_only_read_only_in_generator() {
const _superIndex = name => super[name];
const _super = Object.create(null, {});
return __asyncGenerator(this, arguments, function* element_access_only_read_only_in_generator_1() {
// call with element access
_superIndex("x").call(this);
// element access (read)
const a = _superIndex("x");
// element access in arrow
(() => _superIndex("x").call(this));
// element access in async arrow
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").call(this); }));
});
}
element_access_only_write_only_in_generator() {
const _superIndex = (function (geti, seti) {
const cache = Object.create(null);
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
})(name => super[name], (name, value) => super[name] = value);
const _super = Object.create(null, {});
return __asyncGenerator(this, arguments, function* element_access_only_write_only_in_generator_1() {
const f = () => { };
// element access (assign)
_superIndex("x").value = f;
// destructuring assign with element access
({ f: _superIndex("x").value } = { f });
// element access (assign) in arrow
(() => _superIndex("x").value = f);
// element access (assign) in async arrow
(() => __awaiter(this, void 0, void 0, function* () { return _superIndex("x").value = f; }));
});
}
}
@@ -252,5 +252,127 @@ class B extends A {
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 111, 13))
}
async * property_access_only_read_only_in_generator() {
>property_access_only_read_only_in_generator : Symbol(B.property_access_only_read_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 124, 5))
// call with property access
super.x();
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// property access (read)
const a = super.x;
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 131, 13))
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// property access in arrow
(() => super.x());
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// property access in async arrow
(async () => super.x());
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
}
async * property_access_only_write_only_in_generator() {
>property_access_only_write_only_in_generator : Symbol(B.property_access_only_write_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 138, 5))
const f = () => {};
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
// property access (assign)
super.x = f;
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
// destructuring assign with property access
({ f: super.x } = { f });
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 147, 10))
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 147, 27))
// property access (assign) in arrow
(() => super.x = f);
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
// property access (assign) in async arrow
(async () => super.x = f);
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 141, 13))
}
async * element_access_only_read_only_in_generator() {
>element_access_only_read_only_in_generator : Symbol(B.element_access_only_read_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 154, 5))
// call with element access
super["x"]();
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// element access (read)
const a = super["x"];
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 161, 13))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// element access in arrow
(() => super["x"]());
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
// element access in async arrow
(async () => super["x"]());
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
}
async * element_access_only_write_only_in_generator() {
>element_access_only_write_only_in_generator : Symbol(B.element_access_only_write_only_in_generator, Decl(asyncMethodWithSuper_es6.ts, 168, 5))
const f = () => {};
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
// element access (assign)
super["x"] = f;
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
// destructuring assign with element access
({ f: super["x"] } = { f });
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 177, 10))
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 177, 30))
// element access (assign) in arrow
(() => super["x"] = f);
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
// element access (assign) in async arrow
(async () => super["x"] = f);
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 171, 13))
}
}
@@ -332,6 +332,174 @@ class B extends A {
>super["x"] : () => void
>super : A
>"x" : "x"
>f : () => void
}
async * property_access_only_read_only_in_generator() {
>property_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
// call with property access
super.x();
>super.x() : void
>super.x : () => void
>super : A
>x : () => void
// property access (read)
const a = super.x;
>a : () => void
>super.x : () => void
>super : A
>x : () => void
// property access in arrow
(() => super.x());
>(() => super.x()) : () => void
>() => super.x() : () => void
>super.x() : void
>super.x : () => void
>super : A
>x : () => void
// property access in async arrow
(async () => super.x());
>(async () => super.x()) : () => Promise<void>
>async () => super.x() : () => Promise<void>
>super.x() : void
>super.x : () => void
>super : A
>x : () => void
}
async * property_access_only_write_only_in_generator() {
>property_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
const f = () => {};
>f : () => void
>() => {} : () => void
// property access (assign)
super.x = f;
>super.x = f : () => void
>super.x : () => void
>super : A
>x : () => void
>f : () => void
// destructuring assign with property access
({ f: super.x } = { f });
>({ f: super.x } = { f }) : { f: () => void; }
>{ f: super.x } = { f } : { f: () => void; }
>{ f: super.x } : { f: () => void; }
>f : () => void
>super.x : () => void
>super : A
>x : () => void
>{ f } : { f: () => void; }
>f : () => void
// property access (assign) in arrow
(() => super.x = f);
>(() => super.x = f) : () => () => void
>() => super.x = f : () => () => void
>super.x = f : () => void
>super.x : () => void
>super : A
>x : () => void
>f : () => void
// property access (assign) in async arrow
(async () => super.x = f);
>(async () => super.x = f) : () => Promise<() => void>
>async () => super.x = f : () => Promise<() => void>
>super.x = f : () => void
>super.x : () => void
>super : A
>x : () => void
>f : () => void
}
async * element_access_only_read_only_in_generator() {
>element_access_only_read_only_in_generator : () => AsyncIterableIterator<any>
// call with element access
super["x"]();
>super["x"]() : void
>super["x"] : () => void
>super : A
>"x" : "x"
// element access (read)
const a = super["x"];
>a : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
// element access in arrow
(() => super["x"]());
>(() => super["x"]()) : () => void
>() => super["x"]() : () => void
>super["x"]() : void
>super["x"] : () => void
>super : A
>"x" : "x"
// element access in async arrow
(async () => super["x"]());
>(async () => super["x"]()) : () => Promise<void>
>async () => super["x"]() : () => Promise<void>
>super["x"]() : void
>super["x"] : () => void
>super : A
>"x" : "x"
}
async * element_access_only_write_only_in_generator() {
>element_access_only_write_only_in_generator : () => AsyncIterableIterator<any>
const f = () => {};
>f : () => void
>() => {} : () => void
// element access (assign)
super["x"] = f;
>super["x"] = f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>f : () => void
// destructuring assign with element access
({ f: super["x"] } = { f });
>({ f: super["x"] } = { f }) : { f: () => void; }
>{ f: super["x"] } = { f } : { f: () => void; }
>{ f: super["x"] } : { f: () => void; }
>f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>{ f } : { f: () => void; }
>f : () => void
// element access (assign) in arrow
(() => super["x"] = f);
>(() => super["x"] = f) : () => () => void
>() => super["x"] = f : () => () => void
>super["x"] = f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>f : () => void
// element access (assign) in async arrow
(async () => super["x"] = f);
>(async () => super["x"] = f) : () => Promise<() => void>
>async () => super["x"] = f : () => Promise<() => void>
>super["x"] = f : () => void
>super["x"] : () => void
>super : A
>"x" : "x"
>f : () => void
}
}
@@ -4,11 +4,13 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarO
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(5,6): error TS2456: Type alias 'typeAlias2' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(7,18): error TS2577: Return type annotation circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(9,6): error TS2456: Type alias 'typeAlias3' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(20,3): error TS2322: Type 'number' is not assignable to type 'ReturnType<(input: Input) => ReturnType<typeof mul>>'.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(26,20): error TS2322: Type '0' is not assignable to type 'ReturnType<() => ReturnType<typeof f>>'.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(18,6): error TS2456: Type alias 'R' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(19,29): error TS2577: Return type annotation circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(25,6): error TS2456: Type alias 'R2' circularly references itself.
tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts(26,15): error TS2577: Return type annotation circularly references itself.
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (8 errors) ====
==== tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarOrFunc.ts (10 errors) ====
type typeAlias1 = typeof varOfAliasedType1;
~~~~~~~~~~
!!! error TS2456: Type alias 'typeAlias1' circularly references itself.
@@ -39,16 +41,20 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/circularTypeofWithVarO
}
type R = ReturnType<typeof mul>;
~
!!! error TS2456: Type alias 'R' circularly references itself.
function mul(input: Input): R {
~
!!! error TS2577: Return type annotation circularly references itself.
return input.a * input.b;
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'ReturnType<(input: Input) => ReturnType<typeof mul>>'.
}
// Repro from #26104
type R2 = ReturnType<typeof f>;
~~
!!! error TS2456: Type alias 'R2' circularly references itself.
function f(): R2 { return 0; }
~~~~~~~~~
!!! error TS2322: Type '0' is not assignable to type 'ReturnType<() => ReturnType<typeof f>>'.
~~
!!! error TS2577: Return type annotation circularly references itself.
@@ -37,11 +37,11 @@ interface Input {
}
type R = ReturnType<typeof mul>;
>R : ReturnType<(input: Input) => ReturnType<typeof mul>>
>mul : (input: Input) => ReturnType<typeof mul>
>R : any
>mul : (input: Input) => any
function mul(input: Input): R {
>mul : (input: Input) => ReturnType<typeof mul>
>mul : (input: Input) => any
>input : Input
return input.a * input.b;
@@ -57,10 +57,10 @@ function mul(input: Input): R {
// Repro from #26104
type R2 = ReturnType<typeof f>;
>R2 : ReturnType<() => ReturnType<typeof f>>
>f : () => ReturnType<typeof f>
>R2 : any
>f : () => any
function f(): R2 { return 0; }
>f : () => ReturnType<typeof f>
>f : () => any
>0 : 0
@@ -509,8 +509,6 @@ declare function f5<T extends Options, K extends string>(p: K): Extract<T, {
}>;
declare let x0: {
k: "a";
} & {
k: "a";
a: number;
};
declare type OptionsOfKind<K extends Options["k"]> = Extract<Options, {
@@ -9,7 +9,7 @@ type T02 = Exclude<string | number | (() => void), Function>; // string | numbe
>T02 : string | number
type T03 = Extract<string | number | (() => void), Function>; // () => void
>T03 : Function & (() => void)
>T03 : () => void
type T04 = NonNullable<string | number | undefined>; // string | number
>T04 : string | number
@@ -113,7 +113,7 @@ type T10 = Exclude<Options, { k: "a" | "b" }>; // { k: "c", c: boolean }
>k : "a" | "b"
type T11 = Extract<Options, { k: "a" | "b" }>; // { k: "a", a: number } | { k: "b", b: string }
>T11 : ({ k: "a" | "b"; } & { k: "a"; a: number; }) | ({ k: "a" | "b"; } & { k: "b"; b: string; })
>T11 : { k: "a"; a: number; } | { k: "b"; b: string; }
>k : "a" | "b"
type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
@@ -122,7 +122,7 @@ type T12 = Exclude<Options, { k: "a" } | { k: "b" }>; // { k: "c", c: boolean }
>k : "b"
type T13 = Extract<Options, { k: "a" } | { k: "b" }>; // { k: "a", a: number } | { k: "b", b: string }
>T13 : ({ k: "a"; } & { k: "a"; a: number; }) | ({ k: "b"; } & { k: "a"; a: number; }) | ({ k: "a"; } & { k: "b"; b: string; }) | ({ k: "b"; } & { k: "b"; b: string; })
>T13 : { k: "a"; a: number; } | { k: "b"; b: string; }
>k : "a"
>k : "b"
@@ -140,8 +140,8 @@ declare function f5<T extends Options, K extends string>(p: K): Extract<T, { k:
>k : K
let x0 = f5("a"); // { k: "a", a: number }
>x0 : { k: "a"; } & { k: "a"; a: number; }
>f5("a") : { k: "a"; } & { k: "a"; a: number; }
>x0 : { k: "a"; a: number; }
>f5("a") : { k: "a"; a: number; }
>f5 : <T extends Options, K extends string>(p: K) => Extract<T, { k: K; }>
>"a" : "a"
@@ -150,13 +150,13 @@ type OptionsOfKind<K extends Options["k"]> = Extract<Options, { k: K }>;
>k : K
type T16 = OptionsOfKind<"a" | "b">; // { k: "a", a: number } | { k: "b", b: string }
>T16 : ({ k: "a" | "b"; } & { k: "a"; a: number; }) | ({ k: "a" | "b"; } & { k: "b"; b: string; })
>T16 : { k: "a"; a: number; } | { k: "b"; b: string; }
type Select<T, K extends keyof T, V extends T[K]> = Extract<T, { [P in K]: V }>;
>Select : Extract<T, { [P in K]: V; }>
type T17 = Select<Options, "k", "a" | "b">; // // { k: "a", a: number } | { k: "b", b: string }
>T17 : ({ k: "a" | "b"; } & { k: "a"; a: number; }) | ({ k: "a" | "b"; } & { k: "b"; b: string; })
>T17 : { k: "a"; a: number; } | { k: "b"; b: string; }
type TypeName<T> =
>TypeName : TypeName<T>
@@ -21,13 +21,13 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(25,5): error TS23
Type 'A' is not assignable to type 'B'.
tests/cases/conformance/types/conditional/conditionalTypes2.ts(73,12): error TS2345: Argument of type 'Extract<Extract<T, Foo>, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
Type 'Extract<Foo & T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
tests/cases/conformance/types/conditional/conditionalTypes2.ts(74,12): error TS2345: Argument of type 'Extract<T, Foo & Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
Property 'bat' is missing in type 'Foo & Bar' but required in type '{ foo: string; bat: string; }'.
tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2345: Argument of type 'Extract2<T, Foo, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
Type 'T extends Bar ? T : never' is not assignable to type '{ foo: string; bat: string; }'.
Type 'Bar & Foo & T' is not assignable to type '{ foo: string; bat: string; }'.
Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
==== tests/cases/conformance/types/conditional/conditionalTypes2.ts (7 errors) ====
@@ -132,7 +132,7 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2
~
!!! error TS2345: Argument of type 'Extract<Extract<T, Foo>, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
!!! error TS2345: Type 'Extract<Foo & T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
!!! error TS2345: Type 'Extract<T, Bar>' is not assignable to type '{ foo: string; bat: string; }'.
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
!!! related TS2728 tests/cases/conformance/types/conditional/conditionalTypes2.ts:62:43: 'bat' is declared here.
!!! related TS2728 tests/cases/conformance/types/conditional/conditionalTypes2.ts:62:43: 'bat' is declared here.
@@ -145,7 +145,8 @@ tests/cases/conformance/types/conditional/conditionalTypes2.ts(75,12): error TS2
~
!!! error TS2345: Argument of type 'Extract2<T, Foo, Bar>' is not assignable to parameter of type '{ foo: string; bat: string; }'.
!!! error TS2345: Type 'T extends Bar ? T : never' is not assignable to type '{ foo: string; bat: string; }'.
!!! error TS2345: Type 'Bar & Foo & T' is not assignable to type '{ foo: string; bat: string; }'.
!!! error TS2345: Property 'bat' is missing in type 'Bar & Foo' but required in type '{ foo: string; bat: string; }'.
!!! related TS2728 tests/cases/conformance/types/conditional/conditionalTypes2.ts:62:43: 'bat' is declared here.
}
// Repros from #22860
@@ -130,14 +130,14 @@ function f12(x: string | (() => string) | undefined) {
>x : string | (() => string) | undefined
const f = getFunction(x); // () => string
>f : Function & (() => string)
>getFunction(x) : Function & (() => string)
>f : () => string
>getFunction(x) : () => string
>getFunction : <T>(item: T) => Extract<T, Function>
>x : string | (() => string) | undefined
f();
>f() : string
>f : Function & (() => string)
>f : () => string
}
type Foo = { foo: string };
@@ -0,0 +1,40 @@
//// [contravariantInferenceAndTypeGuard.ts]
interface ListItem<TData> {
prev: ListItem<TData> | null;
next: ListItem<TData> | null;
data: TData;
}
type IteratorFn<TData, TResult, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => TResult;
type FilterFn<TData, TResult extends TData, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => item is TResult;
declare class List<TData> {
filter<TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>;
filter<TResult extends TData>(fn: FilterFn<TData, TResult>): List<TResult>;
filter<TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>;
filter(fn: IteratorFn<TData, boolean>): List<TData>;
}
interface Test {
a: string;
}
const list2 = new List<Test | null>();
const filter1 = list2.filter(function(item, node, list): item is Test {
this.b; // $ExpectType string
item; // $ExpectType Test | null
node; // $ExpectType ListItem<Test | null>
list; // $ExpectType List<Test | null>
return !!item;
}, {b: 'c'});
const x: List<Test> = filter1; // $ExpectType List<Test>
//// [contravariantInferenceAndTypeGuard.js]
"use strict";
var list2 = new List();
var filter1 = list2.filter(function (item, node, list) {
this.b; // $ExpectType string
item; // $ExpectType Test | null
node; // $ExpectType ListItem<Test | null>
list; // $ExpectType List<Test | null>
return !!item;
}, { b: 'c' });
var x = filter1; // $ExpectType List<Test>
@@ -0,0 +1,157 @@
=== tests/cases/compiler/contravariantInferenceAndTypeGuard.ts ===
interface ListItem<TData> {
>ListItem : Symbol(ListItem, Decl(contravariantInferenceAndTypeGuard.ts, 0, 0))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 0, 19))
prev: ListItem<TData> | null;
>prev : Symbol(ListItem.prev, Decl(contravariantInferenceAndTypeGuard.ts, 0, 27))
>ListItem : Symbol(ListItem, Decl(contravariantInferenceAndTypeGuard.ts, 0, 0))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 0, 19))
next: ListItem<TData> | null;
>next : Symbol(ListItem.next, Decl(contravariantInferenceAndTypeGuard.ts, 1, 33))
>ListItem : Symbol(ListItem, Decl(contravariantInferenceAndTypeGuard.ts, 0, 0))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 0, 19))
data: TData;
>data : Symbol(ListItem.data, Decl(contravariantInferenceAndTypeGuard.ts, 2, 33))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 0, 19))
}
type IteratorFn<TData, TResult, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => TResult;
>IteratorFn : Symbol(IteratorFn, Decl(contravariantInferenceAndTypeGuard.ts, 4, 1))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 5, 16))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 5, 22))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 5, 31))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 5, 16))
>this : Symbol(this, Decl(contravariantInferenceAndTypeGuard.ts, 5, 59))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 5, 31))
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 5, 74))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 5, 16))
>node : Symbol(node, Decl(contravariantInferenceAndTypeGuard.ts, 5, 87))
>ListItem : Symbol(ListItem, Decl(contravariantInferenceAndTypeGuard.ts, 0, 0))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 5, 16))
>list : Symbol(list, Decl(contravariantInferenceAndTypeGuard.ts, 5, 110))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 5, 16))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 5, 22))
type FilterFn<TData, TResult extends TData, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => item is TResult;
>FilterFn : Symbol(FilterFn, Decl(contravariantInferenceAndTypeGuard.ts, 5, 141))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 6, 20))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 6, 43))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>this : Symbol(this, Decl(contravariantInferenceAndTypeGuard.ts, 6, 71))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 6, 43))
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 6, 86))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>node : Symbol(node, Decl(contravariantInferenceAndTypeGuard.ts, 6, 99))
>ListItem : Symbol(ListItem, Decl(contravariantInferenceAndTypeGuard.ts, 0, 0))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>list : Symbol(list, Decl(contravariantInferenceAndTypeGuard.ts, 6, 122))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 6, 14))
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 6, 86))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 6, 20))
declare class List<TData> {
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
filter<TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>;
>filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 9, 11))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 9, 20))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>fn : Symbol(fn, Decl(contravariantInferenceAndTypeGuard.ts, 9, 44))
>FilterFn : Symbol(FilterFn, Decl(contravariantInferenceAndTypeGuard.ts, 5, 141))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 9, 20))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 9, 11))
>context : Symbol(context, Decl(contravariantInferenceAndTypeGuard.ts, 9, 83))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 9, 11))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 9, 20))
filter<TResult extends TData>(fn: FilterFn<TData, TResult>): List<TResult>;
>filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 10, 11))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>fn : Symbol(fn, Decl(contravariantInferenceAndTypeGuard.ts, 10, 34))
>FilterFn : Symbol(FilterFn, Decl(contravariantInferenceAndTypeGuard.ts, 5, 141))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 10, 11))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TResult : Symbol(TResult, Decl(contravariantInferenceAndTypeGuard.ts, 10, 11))
filter<TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>;
>filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 11, 11))
>fn : Symbol(fn, Decl(contravariantInferenceAndTypeGuard.ts, 11, 21))
>IteratorFn : Symbol(IteratorFn, Decl(contravariantInferenceAndTypeGuard.ts, 4, 1))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 11, 11))
>context : Symbol(context, Decl(contravariantInferenceAndTypeGuard.ts, 11, 62))
>TContext : Symbol(TContext, Decl(contravariantInferenceAndTypeGuard.ts, 11, 11))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
filter(fn: IteratorFn<TData, boolean>): List<TData>;
>filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>fn : Symbol(fn, Decl(contravariantInferenceAndTypeGuard.ts, 12, 11))
>IteratorFn : Symbol(IteratorFn, Decl(contravariantInferenceAndTypeGuard.ts, 4, 1))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>TData : Symbol(TData, Decl(contravariantInferenceAndTypeGuard.ts, 8, 19))
}
interface Test {
>Test : Symbol(Test, Decl(contravariantInferenceAndTypeGuard.ts, 13, 1))
a: string;
>a : Symbol(Test.a, Decl(contravariantInferenceAndTypeGuard.ts, 14, 16))
}
const list2 = new List<Test | null>();
>list2 : Symbol(list2, Decl(contravariantInferenceAndTypeGuard.ts, 17, 5))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>Test : Symbol(Test, Decl(contravariantInferenceAndTypeGuard.ts, 13, 1))
const filter1 = list2.filter(function(item, node, list): item is Test {
>filter1 : Symbol(filter1, Decl(contravariantInferenceAndTypeGuard.ts, 18, 5))
>list2.filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>list2 : Symbol(list2, Decl(contravariantInferenceAndTypeGuard.ts, 17, 5))
>filter : Symbol(List.filter, Decl(contravariantInferenceAndTypeGuard.ts, 8, 27), Decl(contravariantInferenceAndTypeGuard.ts, 9, 118), Decl(contravariantInferenceAndTypeGuard.ts, 10, 79), Decl(contravariantInferenceAndTypeGuard.ts, 11, 95))
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 18, 38))
>node : Symbol(node, Decl(contravariantInferenceAndTypeGuard.ts, 18, 43))
>list : Symbol(list, Decl(contravariantInferenceAndTypeGuard.ts, 18, 49))
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 18, 38))
>Test : Symbol(Test, Decl(contravariantInferenceAndTypeGuard.ts, 13, 1))
this.b; // $ExpectType string
>this.b : Symbol(b, Decl(contravariantInferenceAndTypeGuard.ts, 24, 4))
>this : Symbol(this, Decl(contravariantInferenceAndTypeGuard.ts, 6, 71))
>b : Symbol(b, Decl(contravariantInferenceAndTypeGuard.ts, 24, 4))
item; // $ExpectType Test | null
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 18, 38))
node; // $ExpectType ListItem<Test | null>
>node : Symbol(node, Decl(contravariantInferenceAndTypeGuard.ts, 18, 43))
list; // $ExpectType List<Test | null>
>list : Symbol(list, Decl(contravariantInferenceAndTypeGuard.ts, 18, 49))
return !!item;
>item : Symbol(item, Decl(contravariantInferenceAndTypeGuard.ts, 18, 38))
}, {b: 'c'});
>b : Symbol(b, Decl(contravariantInferenceAndTypeGuard.ts, 24, 4))
const x: List<Test> = filter1; // $ExpectType List<Test>
>x : Symbol(x, Decl(contravariantInferenceAndTypeGuard.ts, 25, 5))
>List : Symbol(List, Decl(contravariantInferenceAndTypeGuard.ts, 6, 161))
>Test : Symbol(Test, Decl(contravariantInferenceAndTypeGuard.ts, 13, 1))
>filter1 : Symbol(filter1, Decl(contravariantInferenceAndTypeGuard.ts, 18, 5))
@@ -0,0 +1,97 @@
=== tests/cases/compiler/contravariantInferenceAndTypeGuard.ts ===
interface ListItem<TData> {
prev: ListItem<TData> | null;
>prev : ListItem<TData> | null
>null : null
next: ListItem<TData> | null;
>next : ListItem<TData> | null
>null : null
data: TData;
>data : TData
}
type IteratorFn<TData, TResult, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => TResult;
>IteratorFn : IteratorFn<TData, TResult, TContext>
>this : TContext
>item : TData
>node : ListItem<TData>
>list : List<TData>
type FilterFn<TData, TResult extends TData, TContext = List<TData>> = (this: TContext, item: TData, node: ListItem<TData>, list: List<TData>) => item is TResult;
>FilterFn : FilterFn<TData, TResult, TContext>
>this : TContext
>item : TData
>node : ListItem<TData>
>list : List<TData>
declare class List<TData> {
>List : List<TData>
filter<TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>;
>filter : { <TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>; <TResult extends TData>(fn: FilterFn<TData, TResult, List<TData>>): List<TResult>; <TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>; (fn: IteratorFn<TData, boolean, List<TData>>): List<TData>; }
>fn : FilterFn<TData, TResult, TContext>
>context : TContext
filter<TResult extends TData>(fn: FilterFn<TData, TResult>): List<TResult>;
>filter : { <TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>; <TResult extends TData>(fn: FilterFn<TData, TResult, List<TData>>): List<TResult>; <TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>; (fn: IteratorFn<TData, boolean, List<TData>>): List<TData>; }
>fn : FilterFn<TData, TResult, List<TData>>
filter<TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>;
>filter : { <TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>; <TResult extends TData>(fn: FilterFn<TData, TResult, List<TData>>): List<TResult>; <TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>; (fn: IteratorFn<TData, boolean, List<TData>>): List<TData>; }
>fn : IteratorFn<TData, boolean, TContext>
>context : TContext
filter(fn: IteratorFn<TData, boolean>): List<TData>;
>filter : { <TContext, TResult extends TData>(fn: FilterFn<TData, TResult, TContext>, context: TContext): List<TResult>; <TResult extends TData>(fn: FilterFn<TData, TResult, List<TData>>): List<TResult>; <TContext>(fn: IteratorFn<TData, boolean, TContext>, context: TContext): List<TData>; (fn: IteratorFn<TData, boolean, List<TData>>): List<TData>; }
>fn : IteratorFn<TData, boolean, List<TData>>
}
interface Test {
a: string;
>a : string
}
const list2 = new List<Test | null>();
>list2 : List<Test | null>
>new List<Test | null>() : List<Test | null>
>List : typeof List
>null : null
const filter1 = list2.filter(function(item, node, list): item is Test {
>filter1 : List<Test>
>list2.filter(function(item, node, list): item is Test { this.b; // $ExpectType string item; // $ExpectType Test | null node; // $ExpectType ListItem<Test | null> list; // $ExpectType List<Test | null> return !!item;}, {b: 'c'}) : List<Test>
>list2.filter : { <TContext, TResult extends Test | null>(fn: FilterFn<Test | null, TResult, TContext>, context: TContext): List<TResult>; <TResult extends Test | null>(fn: FilterFn<Test | null, TResult, List<Test | null>>): List<TResult>; <TContext>(fn: IteratorFn<Test | null, boolean, TContext>, context: TContext): List<Test | null>; (fn: IteratorFn<Test | null, boolean, List<Test | null>>): List<Test | null>; }
>list2 : List<Test | null>
>filter : { <TContext, TResult extends Test | null>(fn: FilterFn<Test | null, TResult, TContext>, context: TContext): List<TResult>; <TResult extends Test | null>(fn: FilterFn<Test | null, TResult, List<Test | null>>): List<TResult>; <TContext>(fn: IteratorFn<Test | null, boolean, TContext>, context: TContext): List<Test | null>; (fn: IteratorFn<Test | null, boolean, List<Test | null>>): List<Test | null>; }
>function(item, node, list): item is Test { this.b; // $ExpectType string item; // $ExpectType Test | null node; // $ExpectType ListItem<Test | null> list; // $ExpectType List<Test | null> return !!item;} : (this: { b: string; }, item: Test | null, node: ListItem<Test | null>, list: List<Test | null>) => item is Test
>item : Test | null
>node : ListItem<Test | null>
>list : List<Test | null>
this.b; // $ExpectType string
>this.b : string
>this : { b: string; }
>b : string
item; // $ExpectType Test | null
>item : Test | null
node; // $ExpectType ListItem<Test | null>
>node : ListItem<Test | null>
list; // $ExpectType List<Test | null>
>list : List<Test | null>
return !!item;
>!!item : boolean
>!item : boolean
>item : Test | null
}, {b: 'c'});
>{b: 'c'} : { b: string; }
>b : string
>'c' : "c"
const x: List<Test> = filter1; // $ExpectType List<Test>
>x : List<Test>
>filter1 : List<Test>
@@ -0,0 +1,26 @@
//// [decoratorOnClassMethodParameter2.ts]
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(this: C, @dec p: number) {}
}
//// [decoratorOnClassMethodParameter2.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var C = /** @class */ (function () {
function C() {
}
C.prototype.method = function (p) { };
__decorate([
__param(0, dec)
], C.prototype, "method", null);
return C;
}());
@@ -0,0 +1,18 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter2.ts ===
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter2.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassMethodParameter2.ts, 0, 21))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodParameter2.ts, 0, 36))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodParameter2.ts, 0, 66))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethodParameter2.ts, 0, 97))
method(this: C, @dec p: number) {}
>method : Symbol(C.method, Decl(decoratorOnClassMethodParameter2.ts, 2, 9))
>this : Symbol(this, Decl(decoratorOnClassMethodParameter2.ts, 3, 11))
>C : Symbol(C, Decl(decoratorOnClassMethodParameter2.ts, 0, 97))
>dec : Symbol(dec, Decl(decoratorOnClassMethodParameter2.ts, 0, 0))
>p : Symbol(p, Decl(decoratorOnClassMethodParameter2.ts, 3, 19))
}
@@ -0,0 +1,16 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter2.ts ===
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>target : Object
>propertyKey : string | symbol
>parameterIndex : number
class C {
>C : C
method(this: C, @dec p: number) {}
>method : (this: C, p: number) => void
>this : C
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>p : number
}
@@ -0,0 +1,14 @@
tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,17): error TS1003: Identifier expected.
tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts(4,17): error TS2680: A 'this' parameter must be the first parameter.
==== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts (2 errors) ====
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(@dec this: C) {}
~~~~
!!! error TS1003: Identifier expected.
~~~~~~~
!!! error TS2680: A 'this' parameter must be the first parameter.
}
@@ -0,0 +1,26 @@
//// [decoratorOnClassMethodThisParameter.ts]
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
class C {
method(@dec this: C) {}
}
//// [decoratorOnClassMethodThisParameter.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var C = /** @class */ (function () {
function C() {
}
C.prototype.method = function () { };
__decorate([
__param(0, dec)
], C.prototype, "method", null);
return C;
}());
@@ -0,0 +1,18 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts ===
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : Symbol(dec, Decl(decoratorOnClassMethodThisParameter.ts, 0, 0))
>target : Symbol(target, Decl(decoratorOnClassMethodThisParameter.ts, 0, 21))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>propertyKey : Symbol(propertyKey, Decl(decoratorOnClassMethodThisParameter.ts, 0, 36))
>parameterIndex : Symbol(parameterIndex, Decl(decoratorOnClassMethodThisParameter.ts, 0, 66))
class C {
>C : Symbol(C, Decl(decoratorOnClassMethodThisParameter.ts, 0, 97))
method(@dec this: C) {}
>method : Symbol(C.method, Decl(decoratorOnClassMethodThisParameter.ts, 2, 9))
>dec : Symbol(dec, Decl(decoratorOnClassMethodThisParameter.ts, 0, 0))
> : Symbol((Missing), Decl(decoratorOnClassMethodThisParameter.ts, 3, 11))
>this : Symbol(this, Decl(decoratorOnClassMethodThisParameter.ts, 3, 15))
>C : Symbol(C, Decl(decoratorOnClassMethodThisParameter.ts, 0, 97))
}
@@ -0,0 +1,16 @@
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts ===
declare function dec(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>target : Object
>propertyKey : string | symbol
>parameterIndex : number
class C {
>C : C
method(@dec this: C) {}
>method : (: any, this: C) => void
>dec : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
> : any
>this : C
}
@@ -0,0 +1,35 @@
//// [decoratorReferences.ts]
declare function y(...args: any[]): any;
type T = number;
@y(1 as T, C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class
class C<T> {
@y(null as T) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class
method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
}
//// [decoratorReferences.js]
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var C = /** @class */ (function () {
function C() {
}
C_1 = C;
C.prototype.method = function (x, y) { }; // <-- decorator y should be resolved at the class declaration, not the parameter.
var C_1;
__decorate([
y(null) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class
,
__param(0, y)
], C.prototype, "method");
C = C_1 = __decorate([
y(1, C_1) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class
], C);
return C;
}());
@@ -0,0 +1,27 @@
=== tests/cases/compiler/decoratorReferences.ts ===
declare function y(...args: any[]): any;
>y : Symbol(y, Decl(decoratorReferences.ts, 0, 0))
>args : Symbol(args, Decl(decoratorReferences.ts, 0, 19))
type T = number;
>T : Symbol(T, Decl(decoratorReferences.ts, 0, 40))
@y(1 as T, C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class
>y : Symbol(y, Decl(decoratorReferences.ts, 0, 0))
>T : Symbol(T, Decl(decoratorReferences.ts, 0, 40))
>C : Symbol(C, Decl(decoratorReferences.ts, 1, 16))
class C<T> {
>C : Symbol(C, Decl(decoratorReferences.ts, 1, 16))
>T : Symbol(T, Decl(decoratorReferences.ts, 3, 8))
@y(null as T) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class
>y : Symbol(y, Decl(decoratorReferences.ts, 0, 0))
>T : Symbol(T, Decl(decoratorReferences.ts, 3, 8))
method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
>method : Symbol(C.method, Decl(decoratorReferences.ts, 3, 12))
>y : Symbol(y, Decl(decoratorReferences.ts, 0, 0))
>x : Symbol(x, Decl(decoratorReferences.ts, 5, 11))
>y : Symbol(y, Decl(decoratorReferences.ts, 5, 16))
}
@@ -0,0 +1,30 @@
=== tests/cases/compiler/decoratorReferences.ts ===
declare function y(...args: any[]): any;
>y : (...args: any[]) => any
>args : any[]
type T = number;
>T : number
@y(1 as T, C) // <-- T should be resolved to the type alias, not the type parameter of the class; C should resolve to the class
>y(1 as T, C) : any
>y : (...args: any[]) => any
>1 as T : number
>1 : 1
>C : typeof C
class C<T> {
>C : C<T>
@y(null as T) // <-- y should resolve to the function declaration, not the parameter; T should resolve to the type parameter of the class
>y(null as T) : any
>y : (...args: any[]) => any
>null as T : T
>null : null
method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
>method : (x: any, y: any) => void
>y : (...args: any[]) => any
>x : any
>y : any
}
@@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
a1(...array2); // Error parameter type is (number|string)[]
~~~~~~
!!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'?
!!! related TS2728 /.ts/lib.es5.d.ts:1368:15: 'Array' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:1368:13: 'Array' is declared here.
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '[[any]]'.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturing.ts(6,10): error TS2540: Cannot assign to 'name' because it is a read-only property.
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturing.ts(6,10): error TS2339: Property 'name' does not exist on type 'typeof globalThis'.
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturing.ts (1 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturing.ts(6,10
var f2 = (x: string) => {
this.name = x
~~~~
!!! error TS2540: Cannot assign to 'name' because it is a read-only property.
!!! error TS2339: Property 'name' does not exist on type 'typeof globalThis'.
}
function foo(func: () => boolean) { }
@@ -12,9 +12,7 @@ var f2 = (x: string) => {
>x : Symbol(x, Decl(emitArrowFunctionThisCapturing.ts, 4, 10))
this.name = x
>this.name : Symbol(name, Decl(lib.dom.d.ts, --, --))
>this : Symbol(globalThis)
>name : Symbol(name, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(emitArrowFunctionThisCapturing.ts, 4, 10))
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturingES6.ts(6,10): error TS2540: Cannot assign to 'name' because it is a read-only property.
tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturingES6.ts(6,10): error TS2339: Property 'name' does not exist on type 'typeof globalThis'.
==== tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturingES6.ts (1 errors) ====
@@ -9,7 +9,7 @@ tests/cases/conformance/es6/arrowFunction/emitArrowFunctionThisCapturingES6.ts(6
var f2 = (x: string) => {
this.name = x
~~~~
!!! error TS2540: Cannot assign to 'name' because it is a read-only property.
!!! error TS2339: Property 'name' does not exist on type 'typeof globalThis'.
}
function foo(func: () => boolean){ }
@@ -12,9 +12,7 @@ var f2 = (x: string) => {
>x : Symbol(x, Decl(emitArrowFunctionThisCapturingES6.ts, 4, 10))
this.name = x
>this.name : Symbol(name, Decl(lib.dom.d.ts, --, --))
>this : Symbol(globalThis)
>name : Symbol(name, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(emitArrowFunctionThisCapturingES6.ts, 4, 10))
}
@@ -0,0 +1,24 @@
//// [tests/cases/compiler/extendGlobalThis.ts] ////
//// [extension.d.ts]
declare global {
namespace globalThis {
var test: string;
}
}
export {}
//// [index.ts]
import "./extention";
globalThis.tests = "a-b";
console.log(globalThis.test.split("-"));
//// [index.js]
"use strict";
exports.__esModule = true;
require("./extention");
globalThis.tests = "a-b";
console.log(globalThis.test.split("-"));
@@ -0,0 +1,30 @@
=== tests/cases/compiler/extension.d.ts ===
declare global {
>global : Symbol(global, Decl(extension.d.ts, 0, 0))
namespace globalThis {
>globalThis : Symbol(globalThis)
var test: string;
>test : Symbol(test, Decl(extension.d.ts, 2, 11))
}
}
export {}
=== tests/cases/compiler/index.ts ===
import "./extention";
globalThis.tests = "a-b";
>globalThis : Symbol(globalThis)
console.log(globalThis.test.split("-"));
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>globalThis.test.split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
>globalThis.test : Symbol(test, Decl(extension.d.ts, 2, 11))
>globalThis : Symbol(globalThis)
>test : Symbol(test, Decl(extension.d.ts, 2, 11))
>split : Symbol(String.split, Decl(lib.es5.d.ts, --, --))
@@ -0,0 +1,37 @@
=== tests/cases/compiler/extension.d.ts ===
declare global {
>global : typeof global
namespace globalThis {
>globalThis : typeof globalThis
var test: string;
>test : string
}
}
export {}
=== tests/cases/compiler/index.ts ===
import "./extention";
globalThis.tests = "a-b";
>globalThis.tests = "a-b" : "a-b"
>globalThis.tests : any
>globalThis : typeof globalThis
>tests : any
>"a-b" : "a-b"
console.log(globalThis.test.split("-"));
>console.log(globalThis.test.split("-")) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>globalThis.test.split("-") : string[]
>globalThis.test.split : (separator: string | RegExp, limit?: number) => string[]
>globalThis.test : string
>globalThis : typeof globalThis
>test : string
>split : (separator: string | RegExp, limit?: number) => string[]
>"-" : "-"
@@ -69,20 +69,20 @@ tests/cases/compiler/externModule.ts(37,3): error TS2552: Cannot find name 'XDat
var d=new XDate();
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:907:13: 'Date' is declared here.
d.getDay();
d=new XDate(1978,2);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:907:13: 'Date' is declared here.
d.getXDate();
var n=XDate.parse("3/2/2004");
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:907:13: 'Date' is declared here.
n=XDate.UTC(1964,2,1);
~~~~~
!!! error TS2552: Cannot find name 'XDate'. Did you mean 'Date'?
!!! related TS2728 /.ts/lib.es5.d.ts:907:15: 'Date' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:907:13: 'Date' is declared here.
@@ -1,4 +1,4 @@
tests/cases/compiler/genericFunctionInference1.ts(83,14): error TS2345: Argument of type '<a>(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'.
tests/cases/compiler/genericFunctionInference1.ts(88,14): error TS2345: Argument of type '<a>(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'.
Type 'number' is not assignable to type 'string'.
@@ -62,6 +62,11 @@ tests/cases/compiler/genericFunctionInference1.ts(83,14): error TS2345: Argument
const f50 = pipe5(list); // No higher order inference
declare function wrap3<A, B, C>(f: (a: A, b1: B, b2: B) => C): (a: A, b1: B, b2: B) => C;
declare function baz<T, U extends T>(t1: T, t2: T, u: U): [T, U];
let f60 = wrap3(baz);
// #417
function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
@@ -198,4 +203,9 @@ tests/cases/compiler/genericFunctionInference1.ts(83,14): error TS2345: Argument
foo2(() => {});
foo2(identity);
foo2(identity, 1);
// Repro from #30324
declare function times<T>(fn: (i: number) => T): (n: number) => T[];
const a2 = times(identity)(5); // => [0, 1, 2, 3, 4]
@@ -58,6 +58,11 @@ declare function pipe5<A, B>(f: (a: A) => B): { f: (a: A) => B };
const f50 = pipe5(list); // No higher order inference
declare function wrap3<A, B, C>(f: (a: A, b1: B, b2: B) => C): (a: A, b1: B, b2: B) => C;
declare function baz<T, U extends T>(t1: T, t2: T, u: U): [T, U];
let f60 = wrap3(baz);
// #417
function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
@@ -191,6 +196,11 @@ declare function foo2<T, U = T>(fn: T, a?: U, b?: U): [T, U];
foo2(() => {});
foo2(identity);
foo2(identity, 1);
// Repro from #30324
declare function times<T>(fn: (i: number) => T): (n: number) => T[];
const a2 = times(identity)(5); // => [0, 1, 2, 3, 4]
//// [genericFunctionInference1.js]
@@ -231,6 +241,7 @@ const f32 = pipe3(list, list);
const f40 = pipe4([list, box]);
const f41 = pipe4([box, list]);
const f50 = pipe5(list); // No higher order inference
let f60 = wrap3(baz);
// #417
function mirror(f) { return f; }
var identityM = mirror(identity);
@@ -276,3 +287,4 @@ const fn62 = pipe(getArray, x => x, x => first(x));
foo2(() => { });
foo2(identity);
foo2(identity, 1);
const a2 = times(identity)(5); // => [0, 1, 2, 3, 4]
@@ -457,299 +457,339 @@ const f50 = pipe5(list); // No higher order inference
>pipe5 : Symbol(pipe5, Decl(genericFunctionInference1.ts, 53, 31))
>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124))
declare function wrap3<A, B, C>(f: (a: A, b1: B, b2: B) => C): (a: A, b1: B, b2: B) => C;
>wrap3 : Symbol(wrap3, Decl(genericFunctionInference1.ts, 57, 24))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 59, 23))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 59, 25))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 59, 28))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 59, 32))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 59, 36))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 59, 23))
>b1 : Symbol(b1, Decl(genericFunctionInference1.ts, 59, 41))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 59, 25))
>b2 : Symbol(b2, Decl(genericFunctionInference1.ts, 59, 48))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 59, 25))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 59, 28))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 59, 64))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 59, 23))
>b1 : Symbol(b1, Decl(genericFunctionInference1.ts, 59, 69))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 59, 25))
>b2 : Symbol(b2, Decl(genericFunctionInference1.ts, 59, 76))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 59, 25))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 59, 28))
declare function baz<T, U extends T>(t1: T, t2: T, u: U): [T, U];
>baz : Symbol(baz, Decl(genericFunctionInference1.ts, 59, 89))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 21))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 60, 23))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 21))
>t1 : Symbol(t1, Decl(genericFunctionInference1.ts, 60, 37))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 21))
>t2 : Symbol(t2, Decl(genericFunctionInference1.ts, 60, 43))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 21))
>u : Symbol(u, Decl(genericFunctionInference1.ts, 60, 50))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 60, 23))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 21))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 60, 23))
let f60 = wrap3(baz);
>f60 : Symbol(f60, Decl(genericFunctionInference1.ts, 62, 3))
>wrap3 : Symbol(wrap3, Decl(genericFunctionInference1.ts, 57, 24))
>baz : Symbol(baz, Decl(genericFunctionInference1.ts, 59, 89))
// #417
function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 57, 24))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 61, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 61, 26))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 61, 40))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 61, 22))
>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 62, 21))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 66, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 66, 18))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 66, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 66, 26))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 66, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 66, 18))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 66, 40))
>A : Symbol(A, Decl(genericFunctionInference1.ts, 66, 16))
>B : Symbol(B, Decl(genericFunctionInference1.ts, 66, 18))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 66, 22))
var identityM = mirror(identity);
>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 62, 3))
>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 57, 24))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 67, 3))
>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 62, 21))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
var x = 1;
>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 69, 3))
var y = identity(x);
>y : Symbol(y, Decl(genericFunctionInference1.ts, 65, 3))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 70, 3))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 69, 3))
var z = identityM(x);
>z : Symbol(z, Decl(genericFunctionInference1.ts, 66, 3))
>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 62, 3))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3))
>z : Symbol(z, Decl(genericFunctionInference1.ts, 71, 3))
>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 67, 3))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 69, 3))
// #3038
export function keyOf<a>(value: { key: a; }): a {
>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 66, 21))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 70, 25))
>key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22))
>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 71, 21))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 75, 22))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 75, 25))
>key : Symbol(key, Decl(genericFunctionInference1.ts, 75, 33))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 75, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 75, 22))
return value.key;
>value.key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 70, 25))
>key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33))
>value.key : Symbol(key, Decl(genericFunctionInference1.ts, 75, 33))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 75, 25))
>key : Symbol(key, Decl(genericFunctionInference1.ts, 75, 33))
}
export interface Data {
>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 72, 1))
>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 77, 1))
key: number;
>key : Symbol(Data.key, Decl(genericFunctionInference1.ts, 73, 23))
>key : Symbol(Data.key, Decl(genericFunctionInference1.ts, 78, 23))
value: Date;
>value : Symbol(Data.value, Decl(genericFunctionInference1.ts, 74, 16))
>value : Symbol(Data.value, Decl(genericFunctionInference1.ts, 79, 16))
>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
}
var data: Data[] = [];
>data : Symbol(data, Decl(genericFunctionInference1.ts, 78, 3))
>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 72, 1))
>data : Symbol(data, Decl(genericFunctionInference1.ts, 83, 3))
>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 77, 1))
declare function toKeys<a>(values: a[], toKey: (value: a) => string): string[];
>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 78, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24))
>values : Symbol(values, Decl(genericFunctionInference1.ts, 80, 27))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24))
>toKey : Symbol(toKey, Decl(genericFunctionInference1.ts, 80, 39))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 80, 48))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24))
>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 83, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 85, 24))
>values : Symbol(values, Decl(genericFunctionInference1.ts, 85, 27))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 85, 24))
>toKey : Symbol(toKey, Decl(genericFunctionInference1.ts, 85, 39))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 85, 48))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 85, 24))
toKeys(data, keyOf); // Error
>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 78, 22))
>data : Symbol(data, Decl(genericFunctionInference1.ts, 78, 3))
>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 66, 21))
>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 83, 22))
>data : Symbol(data, Decl(genericFunctionInference1.ts, 83, 3))
>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 71, 21))
// #9366
function flip<a, b, c>(f: (a: a, b: b) => c): (b: b, a: a) => c {
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 86, 23))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 27))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 32))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 47))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 52))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 87, 20))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 14))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 16))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 91, 19))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 91, 23))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 27))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 14))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 32))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 16))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 91, 19))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 47))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 16))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 52))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 14))
>c : Symbol(c, Decl(genericFunctionInference1.ts, 91, 19))
return (b: b, a: a) => f(a, b);
>b : Symbol(b, Decl(genericFunctionInference1.ts, 87, 10))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 87, 15))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 86, 23))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 87, 15))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 87, 10))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 92, 10))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 91, 16))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 92, 15))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 91, 14))
>f : Symbol(f, Decl(genericFunctionInference1.ts, 91, 23))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 92, 15))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 92, 10))
}
function zip<T, U>(x: T, y: U): [T, U] {
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 89, 19))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 89, 24))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15))
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 93, 1))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 94, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 94, 15))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 94, 19))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 94, 13))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 94, 24))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 94, 15))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 94, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 94, 15))
return [x, y];
>x : Symbol(x, Decl(genericFunctionInference1.ts, 89, 19))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 89, 24))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 94, 19))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 94, 24))
}
var expected: <T, U>(y: U, x: T) => [T, U] = flip(zip);
>expected : Symbol(expected, Decl(genericFunctionInference1.ts, 93, 3))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 93, 21))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 93, 26))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20))
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1))
>expected : Symbol(expected, Decl(genericFunctionInference1.ts, 98, 3))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 15))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 17))
>y : Symbol(y, Decl(genericFunctionInference1.ts, 98, 21))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 17))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 98, 26))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 15))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 15))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 17))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 87, 20))
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 93, 1))
var actual = flip(zip);
>actual : Symbol(actual, Decl(genericFunctionInference1.ts, 94, 3))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20))
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1))
>actual : Symbol(actual, Decl(genericFunctionInference1.ts, 99, 3))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 87, 20))
>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 93, 1))
// #9366
const map = <T, U>(transform: (t: T) => U) =>
>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 15))
>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 98, 19))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 98, 31))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 15))
>map : Symbol(map, Decl(genericFunctionInference1.ts, 103, 5))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 103, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 103, 15))
>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 103, 19))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 103, 31))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 103, 13))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 103, 15))
(arr: T[]) => arr.map(transform)
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 99, 5))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13))
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 104, 5))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 103, 13))
>arr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 99, 5))
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 104, 5))
>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 98, 19))
>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 103, 19))
const identityStr = (t: string) => t;
>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 101, 5))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 101, 21))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 101, 21))
>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 106, 5))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 106, 21))
>t : Symbol(t, Decl(genericFunctionInference1.ts, 106, 21))
const arr: string[] = map(identityStr)(['a']);
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 103, 5))
>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5))
>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 101, 5))
>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 108, 5))
>map : Symbol(map, Decl(genericFunctionInference1.ts, 103, 5))
>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 106, 5))
const arr1: string[] = map(identity)(['a']);
>arr1 : Symbol(arr1, Decl(genericFunctionInference1.ts, 104, 5))
>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>arr1 : Symbol(arr1, Decl(genericFunctionInference1.ts, 109, 5))
>map : Symbol(map, Decl(genericFunctionInference1.ts, 103, 5))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
// #9949
function of2<a, b>(one: a, two: b): [a, b] {
>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 104, 44))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15))
>one : Symbol(one, Decl(genericFunctionInference1.ts, 108, 19))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13))
>two : Symbol(two, Decl(genericFunctionInference1.ts, 108, 26))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15))
>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 109, 44))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 113, 13))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 113, 15))
>one : Symbol(one, Decl(genericFunctionInference1.ts, 113, 19))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 113, 13))
>two : Symbol(two, Decl(genericFunctionInference1.ts, 113, 26))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 113, 15))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 113, 13))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 113, 15))
return [one, two];
>one : Symbol(one, Decl(genericFunctionInference1.ts, 108, 19))
>two : Symbol(two, Decl(genericFunctionInference1.ts, 108, 26))
>one : Symbol(one, Decl(genericFunctionInference1.ts, 113, 19))
>two : Symbol(two, Decl(genericFunctionInference1.ts, 113, 26))
}
const flipped = flip(of2);
>flipped : Symbol(flipped, Decl(genericFunctionInference1.ts, 112, 5))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20))
>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 104, 44))
>flipped : Symbol(flipped, Decl(genericFunctionInference1.ts, 117, 5))
>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 87, 20))
>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 109, 44))
// #29904.1
type Component<P> = (props: P) => {};
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 116, 15))
>props : Symbol(props, Decl(genericFunctionInference1.ts, 116, 21))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 116, 15))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 121, 15))
>props : Symbol(props, Decl(genericFunctionInference1.ts, 121, 21))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 121, 15))
declare const myHoc1: <P>(C: Component<P>) => Component<P>;
>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 118, 13))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 118, 26))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23))
>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 123, 13))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 123, 23))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 123, 26))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 123, 23))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 123, 23))
declare const myHoc2: <P>(C: Component<P>) => Component<P>;
>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 119, 13))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 119, 26))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23))
>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 124, 13))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 124, 23))
>C : Symbol(C, Decl(genericFunctionInference1.ts, 124, 26))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 124, 23))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>P : Symbol(P, Decl(genericFunctionInference1.ts, 124, 23))
declare const MyComponent1: Component<{ foo: 1 }>;
>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 121, 13))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26))
>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 121, 39))
>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 126, 13))
>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 117, 26))
>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 126, 39))
const enhance = pipe(
>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 123, 5))
>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 128, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
myHoc1,
>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 118, 13))
>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 123, 13))
myHoc2,
>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 119, 13))
>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 124, 13))
);
const MyComponent2 = enhance(MyComponent1);
>MyComponent2 : Symbol(MyComponent2, Decl(genericFunctionInference1.ts, 128, 5))
>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 123, 5))
>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 121, 13))
>MyComponent2 : Symbol(MyComponent2, Decl(genericFunctionInference1.ts, 133, 5))
>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 128, 5))
>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 126, 13))
// #29904.2
const fn20 = pipe((_a?: {}) => 1);
>fn20 : Symbol(fn20, Decl(genericFunctionInference1.ts, 132, 5))
>fn20 : Symbol(fn20, Decl(genericFunctionInference1.ts, 137, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
>_a : Symbol(_a, Decl(genericFunctionInference1.ts, 132, 19))
>_a : Symbol(_a, Decl(genericFunctionInference1.ts, 137, 19))
// #29904.3
type Fn = (n: number) => number;
>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 132, 34))
>n : Symbol(n, Decl(genericFunctionInference1.ts, 136, 11))
>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 137, 34))
>n : Symbol(n, Decl(genericFunctionInference1.ts, 141, 11))
const fn30: Fn = pipe(
>fn30 : Symbol(fn30, Decl(genericFunctionInference1.ts, 137, 5))
>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 132, 34))
>fn30 : Symbol(fn30, Decl(genericFunctionInference1.ts, 142, 5))
>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 137, 34))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
x => x + 1,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 137, 22))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 137, 22))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 142, 22))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 142, 22))
x => x * 2,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 138, 15))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 138, 15))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 143, 15))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 143, 15))
);
const promise = Promise.resolve(1);
>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 142, 5))
>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 147, 5))
>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.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
promise.then(
>promise.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 142, 5))
>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 147, 5))
>then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --))
pipe(
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
x => x + 1,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 144, 9))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 144, 9))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 149, 9))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 149, 9))
x => x * 2,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 145, 19))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 145, 19))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 150, 19))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 150, 19))
),
);
@@ -757,121 +797,137 @@ promise.then(
// #29904.4
declare const getString: () => string;
>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 152, 13))
>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 157, 13))
declare const orUndefined: (name: string) => string | undefined;
>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 153, 13))
>name : Symbol(name, Decl(genericFunctionInference1.ts, 153, 28))
>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 158, 13))
>name : Symbol(name, Decl(genericFunctionInference1.ts, 158, 28))
declare const identity: <T>(value: T) => T;
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 154, 28))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 159, 25))
>value : Symbol(value, Decl(genericFunctionInference1.ts, 159, 28))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 159, 25))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 159, 25))
const fn40 = pipe(
>fn40 : Symbol(fn40, Decl(genericFunctionInference1.ts, 156, 5))
>fn40 : Symbol(fn40, Decl(genericFunctionInference1.ts, 161, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
getString,
>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 152, 13))
>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 157, 13))
string => orUndefined(string),
>string : Symbol(string, Decl(genericFunctionInference1.ts, 157, 14))
>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 153, 13))
>string : Symbol(string, Decl(genericFunctionInference1.ts, 157, 14))
>string : Symbol(string, Decl(genericFunctionInference1.ts, 162, 14))
>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 158, 13))
>string : Symbol(string, Decl(genericFunctionInference1.ts, 162, 14))
identity,
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
);
// #29904.6
declare const getArray: () => string[];
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13))
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 169, 13))
declare const first: <T>(ts: T[]) => T;
>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22))
>ts : Symbol(ts, Decl(genericFunctionInference1.ts, 165, 25))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22))
>first : Symbol(first, Decl(genericFunctionInference1.ts, 170, 13))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 170, 22))
>ts : Symbol(ts, Decl(genericFunctionInference1.ts, 170, 25))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 170, 22))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 170, 22))
const fn60 = pipe(
>fn60 : Symbol(fn60, Decl(genericFunctionInference1.ts, 167, 5))
>fn60 : Symbol(fn60, Decl(genericFunctionInference1.ts, 172, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
getArray,
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13))
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 169, 13))
x => x,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 168, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 168, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 173, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 173, 13))
first,
>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13))
>first : Symbol(first, Decl(genericFunctionInference1.ts, 170, 13))
);
const fn61 = pipe(
>fn61 : Symbol(fn61, Decl(genericFunctionInference1.ts, 173, 5))
>fn61 : Symbol(fn61, Decl(genericFunctionInference1.ts, 178, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
getArray,
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13))
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 169, 13))
identity,
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
first,
>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13))
>first : Symbol(first, Decl(genericFunctionInference1.ts, 170, 13))
);
const fn62 = pipe(
>fn62 : Symbol(fn62, Decl(genericFunctionInference1.ts, 179, 5))
>fn62 : Symbol(fn62, Decl(genericFunctionInference1.ts, 184, 5))
>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104))
getArray,
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13))
>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 169, 13))
x => x,
>x : Symbol(x, Decl(genericFunctionInference1.ts, 180, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 180, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 185, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 185, 13))
x => first(x),
>x : Symbol(x, Decl(genericFunctionInference1.ts, 181, 11))
>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 181, 11))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 186, 11))
>first : Symbol(first, Decl(genericFunctionInference1.ts, 170, 13))
>x : Symbol(x, Decl(genericFunctionInference1.ts, 186, 11))
);
// Repro from #30297
declare function foo2<T, U = T>(fn: T, a?: U, b?: U): [T, U];
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22))
>fn : Symbol(fn, Decl(genericFunctionInference1.ts, 187, 32))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 187, 38))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 187, 45))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 187, 22))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 187, 24))
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 188, 2))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 192, 22))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 192, 24))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 192, 22))
>fn : Symbol(fn, Decl(genericFunctionInference1.ts, 192, 32))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 192, 22))
>a : Symbol(a, Decl(genericFunctionInference1.ts, 192, 38))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 192, 24))
>b : Symbol(b, Decl(genericFunctionInference1.ts, 192, 45))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 192, 24))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 192, 22))
>U : Symbol(U, Decl(genericFunctionInference1.ts, 192, 24))
foo2(() => {});
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2))
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 188, 2))
foo2(identity);
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 188, 2))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
foo2(identity, 1);
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 183, 2))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13))
>foo2 : Symbol(foo2, Decl(genericFunctionInference1.ts, 188, 2))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
// Repro from #30324
declare function times<T>(fn: (i: number) => T): (n: number) => T[];
>times : Symbol(times, Decl(genericFunctionInference1.ts, 196, 18))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 200, 23))
>fn : Symbol(fn, Decl(genericFunctionInference1.ts, 200, 26))
>i : Symbol(i, Decl(genericFunctionInference1.ts, 200, 31))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 200, 23))
>n : Symbol(n, Decl(genericFunctionInference1.ts, 200, 50))
>T : Symbol(T, Decl(genericFunctionInference1.ts, 200, 23))
const a2 = times(identity)(5); // => [0, 1, 2, 3, 4]
>a2 : Symbol(a2, Decl(genericFunctionInference1.ts, 201, 5))
>times : Symbol(times, Decl(genericFunctionInference1.ts, 196, 18))
>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 159, 13))
@@ -421,6 +421,28 @@ const f50 = pipe5(list); // No higher order inference
>pipe5 : <A, B>(f: (a: A) => B) => { f: (a: A) => B; }
>list : <T>(a: T) => T[]
declare function wrap3<A, B, C>(f: (a: A, b1: B, b2: B) => C): (a: A, b1: B, b2: B) => C;
>wrap3 : <A, B, C>(f: (a: A, b1: B, b2: B) => C) => (a: A, b1: B, b2: B) => C
>f : (a: A, b1: B, b2: B) => C
>a : A
>b1 : B
>b2 : B
>a : A
>b1 : B
>b2 : B
declare function baz<T, U extends T>(t1: T, t2: T, u: U): [T, U];
>baz : <T, U extends T>(t1: T, t2: T, u: U) => [T, U]
>t1 : T
>t2 : T
>u : U
let f60 = wrap3(baz);
>f60 : <T, U extends T>(a: T, b1: U, b2: U) => [T, U]
>wrap3(baz) : <T, U extends T>(a: T, b1: U, b2: U) => [T, U]
>wrap3 : <A, B, C>(f: (a: A, b1: B, b2: B) => C) => (a: A, b1: B, b2: B) => C
>baz : <T, U extends T>(t1: T, t2: T, u: U) => [T, U]
// #417
function mirror<A, B>(f: (a: A) => B): (a: A) => B { return f; }
@@ -823,3 +845,19 @@ foo2(identity, 1);
>identity : <T>(value: T) => T
>1 : 1
// Repro from #30324
declare function times<T>(fn: (i: number) => T): (n: number) => T[];
>times : <T>(fn: (i: number) => T) => (n: number) => T[]
>fn : (i: number) => T
>i : number
>n : number
const a2 = times(identity)(5); // => [0, 1, 2, 3, 4]
>a2 : number[]
>times(identity)(5) : number[]
>times(identity) : (n: number) => number[]
>times : <T>(fn: (i: number) => T) => (n: number) => T[]
>identity : <T>(value: T) => T
>5 : 5
@@ -0,0 +1,38 @@
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(5,12): error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(6,12): error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(8,1): error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(9,1): error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(14,40): error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts(15,40): error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
==== tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts (6 errors) ====
var x = 1
const y = 2
let z = 3
globalThis.x // ok
globalThis.y // should error, no property 'y'
~
!!! error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
globalThis.z // should error, no property 'z'
~
!!! error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
globalThis['x'] // ok
globalThis['y'] // should error, no property 'y'
~~~~~~~~~~~~~~~
!!! error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
globalThis['z'] // should error, no property 'z'
~~~~~~~~~~~~~~~
!!! error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
globalThis.Float64Array // ok
globalThis.Infinity // ok
declare let test1: (typeof globalThis)['x'] // ok
declare let test2: (typeof globalThis)['y'] // error
~~~
!!! error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
declare let test3: (typeof globalThis)['z'] // error
~~~
!!! error TS2339: Property 'z' does not exist on type 'typeof globalThis'.
declare let themAll: keyof typeof globalThis
@@ -0,0 +1,31 @@
//// [globalThisBlockscopedProperties.ts]
var x = 1
const y = 2
let z = 3
globalThis.x // ok
globalThis.y // should error, no property 'y'
globalThis.z // should error, no property 'z'
globalThis['x'] // ok
globalThis['y'] // should error, no property 'y'
globalThis['z'] // should error, no property 'z'
globalThis.Float64Array // ok
globalThis.Infinity // ok
declare let test1: (typeof globalThis)['x'] // ok
declare let test2: (typeof globalThis)['y'] // error
declare let test3: (typeof globalThis)['z'] // error
declare let themAll: keyof typeof globalThis
//// [globalThisBlockscopedProperties.js]
var x = 1;
var y = 2;
var z = 3;
globalThis.x; // ok
globalThis.y; // should error, no property 'y'
globalThis.z; // should error, no property 'z'
globalThis['x']; // ok
globalThis['y']; // should error, no property 'y'
globalThis['z']; // should error, no property 'z'
globalThis.Float64Array; // ok
globalThis.Infinity; // ok
@@ -0,0 +1,57 @@
=== tests/cases/conformance/es2019/globalThisBlockscopedProperties.ts ===
var x = 1
>x : Symbol(x, Decl(globalThisBlockscopedProperties.ts, 0, 3))
const y = 2
>y : Symbol(y, Decl(globalThisBlockscopedProperties.ts, 1, 5))
let z = 3
>z : Symbol(z, Decl(globalThisBlockscopedProperties.ts, 2, 3))
globalThis.x // ok
>globalThis.x : Symbol(x, Decl(globalThisBlockscopedProperties.ts, 0, 3))
>globalThis : Symbol(globalThis)
>x : Symbol(x, Decl(globalThisBlockscopedProperties.ts, 0, 3))
globalThis.y // should error, no property 'y'
>globalThis : Symbol(globalThis)
globalThis.z // should error, no property 'z'
>globalThis : Symbol(globalThis)
globalThis['x'] // ok
>globalThis : Symbol(globalThis)
>'x' : Symbol(x, Decl(globalThisBlockscopedProperties.ts, 0, 3))
globalThis['y'] // should error, no property 'y'
>globalThis : Symbol(globalThis)
globalThis['z'] // should error, no property 'z'
>globalThis : Symbol(globalThis)
globalThis.Float64Array // ok
>globalThis.Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>Float64Array : Symbol(Float64Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
globalThis.Infinity // ok
>globalThis.Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --))
>globalThis : Symbol(globalThis)
>Infinity : Symbol(Infinity, Decl(lib.es5.d.ts, --, --))
declare let test1: (typeof globalThis)['x'] // ok
>test1 : Symbol(test1, Decl(globalThisBlockscopedProperties.ts, 12, 11))
>globalThis : Symbol(globalThis)
declare let test2: (typeof globalThis)['y'] // error
>test2 : Symbol(test2, Decl(globalThisBlockscopedProperties.ts, 13, 11))
>globalThis : Symbol(globalThis)
declare let test3: (typeof globalThis)['z'] // error
>test3 : Symbol(test3, Decl(globalThisBlockscopedProperties.ts, 14, 11))
>globalThis : Symbol(globalThis)
declare let themAll: keyof typeof globalThis
>themAll : Symbol(themAll, Decl(globalThisBlockscopedProperties.ts, 15, 11))
>globalThis : Symbol(globalThis)
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
tests/cases/conformance/es2019/globalThisReadonlyProperties.ts(1,12): error TS2540: Cannot assign to 'globalThis' because it is a read-only property.
tests/cases/conformance/es2019/globalThisReadonlyProperties.ts(5,12): error TS2540: Cannot assign to 'y' because it is a read-only property.
tests/cases/conformance/es2019/globalThisReadonlyProperties.ts(5,12): error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
==== tests/cases/conformance/es2019/globalThisReadonlyProperties.ts (2 errors) ====
@@ -11,5 +11,5 @@ tests/cases/conformance/es2019/globalThisReadonlyProperties.ts(5,12): error TS25
globalThis.x = 3
globalThis.y = 4 // should error
~
!!! error TS2540: Cannot assign to 'y' because it is a read-only property.
!!! error TS2339: Property 'y' does not exist on type 'typeof globalThis'.
@@ -16,7 +16,5 @@ globalThis.x = 3
>x : Symbol(x, Decl(globalThisReadonlyProperties.ts, 1, 3))
globalThis.y = 4 // should error
>globalThis.y : Symbol(y, Decl(globalThisReadonlyProperties.ts, 2, 5))
>globalThis : Symbol(globalThis)
>y : Symbol(y, Decl(globalThisReadonlyProperties.ts, 2, 5))
@@ -1,12 +1,13 @@
tests/cases/compiler/infiniteConstraints.ts(3,37): error TS2589: Type instantiation is excessively deep and possibly infinite.
tests/cases/compiler/infiniteConstraints.ts(4,37): error TS2536: Type '"val"' cannot be used to index type 'B[Exclude<keyof B, K>]'.
tests/cases/compiler/infiniteConstraints.ts(21,21): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[K], Record<"val", string>>'.
tests/cases/compiler/infiniteConstraints.ts(21,57): error TS2536: Type '"val"' cannot be used to index type 'Extract<T[Exclude<keyof T, K>], Record<"val", string>>'.
tests/cases/compiler/infiniteConstraints.ts(31,43): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
tests/cases/compiler/infiniteConstraints.ts(31,63): error TS2322: Type 'Record<"val", "dup">' is not assignable to type 'never'.
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2589: Type instantiation is excessively deep and possibly infinite.
==== tests/cases/compiler/infiniteConstraints.ts (6 errors) ====
==== tests/cases/compiler/infiniteConstraints.ts (7 errors) ====
// Both of the following types trigger the recursion limiter in getImmediateBaseConstraint
type T1<B extends { [K in keyof B]: Extract<B[Exclude<keyof B, K>], { val: string }>["val"] }> = B;
@@ -32,6 +33,10 @@ tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2589: Type instantia
declare function ensureNoDuplicates<
T extends {
[K in keyof T]: Extract<T[K], Value>["val"] extends Extract<T[Exclude<keyof T, K>], Value>["val"]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2536: Type '"val"' cannot be used to index type 'Extract<T[K], Record<"val", string>>'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2536: Type '"val"' cannot be used to index type 'Extract<T[Exclude<keyof T, K>], Record<"val", string>>'.
? never
: any
}
@@ -55,6 +60,4 @@ tests/cases/compiler/infiniteConstraints.ts(36,71): error TS2589: Type instantia
declare function function1<T extends {[K in keyof T]: Cond<T[K]>}>(): T[keyof T]["foo"];
~~~~~~~~~~~~~~~~~
!!! error TS2536: Type '"foo"' cannot be used to index type 'T[keyof T]'.
~~~~~~~~~~~~~~~~~
!!! error TS2589: Type instantiation is excessively deep and possibly infinite.
@@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeQueries/invalidTypeOfTarget.ts
var x7: typeof function f() { };
~~~~~~~~
!!! error TS2552: Cannot find name 'function'. Did you mean 'Function'?
!!! related TS2728 /.ts/lib.es5.d.ts:316:15: 'Function' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:316:13: 'Function' is declared here.
~
!!! error TS1005: ',' expected.
~
@@ -11,4 +11,4 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserMemberAccessAfterPo
!!! error TS1005: ';' expected.
~~~~~~~~
!!! error TS2552: Cannot find name 'toString'. Did you mean 'String'?
!!! related TS2728 /.ts/lib.es5.d.ts:527:15: 'String' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:527:13: 'String' is declared here.
@@ -19,7 +19,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS
$ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
//CHECK#2
@@ -28,7 +28,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.2_A1.5_T2.ts(20,3): error TS
$ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
@@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript5/parserS7.3_A1.1_T2.ts(17,3): error TS
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
@@ -50,70 +50,70 @@ tests/cases/conformance/parser/ecmascript5/parserS7.6_A4.2_T1.ts(142,3): error T
$ERROR('#А');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0411 = 1;
if (Б !== 1) {
$ERROR('#Б');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0412 = 1;
if (В !== 1) {
$ERROR('#В');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0413 = 1;
if (Г !== 1) {
$ERROR('#Г');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0414 = 1;
if (Д !== 1) {
$ERROR('#Д');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0415 = 1;
if (Е !== 1) {
$ERROR('#Е');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0416 = 1;
if (Ж !== 1) {
$ERROR('#Ж');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0417 = 1;
if (З !== 1) {
$ERROR('#З');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0418 = 1;
if (И !== 1) {
$ERROR('#И');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0419 = 1;
if (Й !== 1) {
$ERROR('#Й');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u041A = 1;
if (К !== 1) {
@@ -11,13 +11,13 @@ tests/cases/conformance/parser/ecmascript5/parserUnicode1.ts(10,5): error TS2552
$ERROR('#6.1: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
}
catch (e) {
$ERROR('#6.2: var \\u0078x = 1; xx === 6. Actual: ' + (xx));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
@@ -0,0 +1,219 @@
//// [reactReduxLikeDeferredInferenceAllowsAssignment.ts]
declare class Component<P> {
constructor(props: Readonly<P>);
constructor(props: P, context?: any);
readonly props: Readonly<P> & Readonly<{ children?: {} }>;
}
interface ComponentClass<P = {}> {
new (props: P, context?: any): Component<P>;
propTypes?: WeakValidationMap<P>;
defaultProps?: Partial<P>;
displayName?: string;
}
interface FunctionComponent<P = {}> {
(props: P & { children?: {} }, context?: any): {} | null;
propTypes?: WeakValidationMap<P>;
defaultProps?: Partial<P>;
displayName?: string;
}
declare const nominalTypeHack: unique symbol;
interface Validator<T> {
(
props: object,
propName: string,
componentName: string,
location: string,
propFullName: string
): Error | null;
[nominalTypeHack]?: T;
}
type WeakValidationMap<T> = {
[K in keyof T]?: null extends T[K]
? Validator<T[K] | null | undefined>
: undefined extends T[K]
? Validator<T[K] | null | undefined>
: Validator<T[K]>
};
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
type Shared<
InjectedProps,
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>
> = {
[P in Extract<
keyof InjectedProps,
keyof DecorationTargetProps
>]?: InjectedProps[P] extends DecorationTargetProps[P]
? DecorationTargetProps[P]
: never
};
// Infers prop type from component C
type GetProps<C> = C extends ComponentType<infer P> ? P : never;
type ConnectedComponentClass<C extends ComponentType<any>, P> = ComponentClass<
P
> & {
WrappedComponent: C;
};
type Matching<InjectedProps, DecorationTargetProps> = {
[P in keyof DecorationTargetProps]: P extends keyof InjectedProps
? InjectedProps[P] extends DecorationTargetProps[P]
? DecorationTargetProps[P]
: InjectedProps[P]
: DecorationTargetProps[P]
};
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <
C extends ComponentType<Matching<TInjectedProps, GetProps<C>>>
>(
component: C
) => ConnectedComponentClass<
C,
Omit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> & TNeedsProps
>;
declare const connect: {
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
mapDispatchToProps: TDispatchProps
): InferableComponentEnhancerWithProps<
ResolveThunks<TDispatchProps>,
TOwnProps
>;
};
type InferThunkActionCreatorType<
TActionCreator extends (...args: any[]) => any
> = TActionCreator extends (
...args: infer TParams
) => (...args: any[]) => infer TReturn
? (...args: TParams) => TReturn
: TActionCreator;
type HandleThunkActionCreator<TActionCreator> = TActionCreator extends (
...args: any[]
) => any
? InferThunkActionCreatorType<TActionCreator>
: TActionCreator;
type ResolveThunks<TDispatchProps> = TDispatchProps extends {
[key: string]: any;
}
? { [C in keyof TDispatchProps]: HandleThunkActionCreator<TDispatchProps[C]> }
: TDispatchProps;
interface Dispatch<A extends Action = AnyAction> {
<T extends A>(action: T): T;
}
interface Action<T = any> {
type: T;
}
interface AnyAction extends Action {
[extraProps: string]: any;
}
const simpleAction = (payload: boolean) => ({
type: "SIMPLE_ACTION",
payload
});
const thunkAction = (param1: number, param2: string) => async (
dispatch: Dispatch,
{ foo }: OwnProps
) => {
return foo;
};
interface OwnProps {
foo: string;
}
interface TestComponentProps extends OwnProps {
simpleAction: typeof simpleAction;
thunkAction(param1: number, param2: string): Promise<string>;
}
class TestComponent extends Component<TestComponentProps> {}
const mapDispatchToProps = { simpleAction, thunkAction };
type Q = HandleThunkActionCreator<typeof simpleAction>;
const Test1 = connect(
null,
mapDispatchToProps
)(TestComponent);
//// [reactReduxLikeDeferredInferenceAllowsAssignment.js]
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var _this = this;
var simpleAction = function (payload) { return ({
type: "SIMPLE_ACTION",
payload: payload
}); };
var thunkAction = function (param1, param2) { return function (dispatch, _a) {
var foo = _a.foo;
return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_b) {
return [2 /*return*/, foo];
});
});
}; };
var TestComponent = /** @class */ (function (_super) {
__extends(TestComponent, _super);
function TestComponent() {
return _super !== null && _super.apply(this, arguments) || this;
}
return TestComponent;
}(Component));
var mapDispatchToProps = { simpleAction: simpleAction, thunkAction: thunkAction };
var Test1 = connect(null, mapDispatchToProps)(TestComponent);
@@ -0,0 +1,471 @@
=== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts ===
declare class Component<P> {
>Component : Symbol(Component, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 0))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 24))
constructor(props: Readonly<P>);
>props : Symbol(props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 1, 14))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 24))
constructor(props: P, context?: any);
>props : Symbol(props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 2, 14))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 24))
>context : Symbol(context, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 2, 23))
readonly props: Readonly<P> & Readonly<{ children?: {} }>;
>props : Symbol(Component.props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 2, 39))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 24))
>Readonly : Symbol(Readonly, Decl(lib.es5.d.ts, --, --))
>children : Symbol(children, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 3, 42))
}
interface ComponentClass<P = {}> {
>ComponentClass : Symbol(ComponentClass, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 4, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 5, 25))
new (props: P, context?: any): Component<P>;
>props : Symbol(props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 6, 7))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 5, 25))
>context : Symbol(context, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 6, 16))
>Component : Symbol(Component, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 0))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 5, 25))
propTypes?: WeakValidationMap<P>;
>propTypes : Symbol(ComponentClass.propTypes, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 6, 46))
>WeakValidationMap : Symbol(WeakValidationMap, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 28, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 5, 25))
defaultProps?: Partial<P>;
>defaultProps : Symbol(ComponentClass.defaultProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 7, 35))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 5, 25))
displayName?: string;
>displayName : Symbol(ComponentClass.displayName, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 8, 28))
}
interface FunctionComponent<P = {}> {
>FunctionComponent : Symbol(FunctionComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 10, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 11, 28))
(props: P & { children?: {} }, context?: any): {} | null;
>props : Symbol(props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 12, 3))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 11, 28))
>children : Symbol(children, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 12, 15))
>context : Symbol(context, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 12, 32))
propTypes?: WeakValidationMap<P>;
>propTypes : Symbol(FunctionComponent.propTypes, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 12, 59))
>WeakValidationMap : Symbol(WeakValidationMap, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 28, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 11, 28))
defaultProps?: Partial<P>;
>defaultProps : Symbol(FunctionComponent.defaultProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 13, 35))
>Partial : Symbol(Partial, Decl(lib.es5.d.ts, --, --))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 11, 28))
displayName?: string;
>displayName : Symbol(FunctionComponent.displayName, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 14, 28))
}
declare const nominalTypeHack: unique symbol;
>nominalTypeHack : Symbol(nominalTypeHack, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 13))
interface Validator<T> {
>Validator : Symbol(Validator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 45))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 19, 20))
(
props: object,
>props : Symbol(props, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 20, 3))
propName: string,
>propName : Symbol(propName, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 21, 18))
componentName: string,
>componentName : Symbol(componentName, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 22, 21))
location: string,
>location : Symbol(location, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 23, 26))
propFullName: string
>propFullName : Symbol(propFullName, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 24, 21))
): Error | null;
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
[nominalTypeHack]?: T;
>[nominalTypeHack] : Symbol(Validator[nominalTypeHack], Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 26, 18))
>nominalTypeHack : Symbol(nominalTypeHack, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 13))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 19, 20))
}
type WeakValidationMap<T> = {
>WeakValidationMap : Symbol(WeakValidationMap, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 28, 1))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
[K in keyof T]?: null extends T[K]
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
? Validator<T[K] | null | undefined>
>Validator : Symbol(Validator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 45))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
: undefined extends T[K]
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
? Validator<T[K] | null | undefined>
>Validator : Symbol(Validator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 45))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
: Validator<T[K]>
>Validator : Symbol(Validator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 18, 45))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 29, 23))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 30, 3))
};
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
>ComponentType : Symbol(ComponentType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 35, 2))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 19))
>ComponentClass : Symbol(ComponentClass, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 4, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 19))
>FunctionComponent : Symbol(FunctionComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 10, 1))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 19))
type Shared<
>Shared : Symbol(Shared, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 70))
InjectedProps,
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 38, 12))
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 39, 16))
>Shared : Symbol(Shared, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 70))
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 38, 12))
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 39, 16))
> = {
[P in Extract<
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 42, 3))
>Extract : Symbol(Extract, Decl(lib.es5.d.ts, --, --))
keyof InjectedProps,
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 38, 12))
keyof DecorationTargetProps
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 39, 16))
>]?: InjectedProps[P] extends DecorationTargetProps[P]
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 38, 12))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 42, 3))
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 39, 16))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 42, 3))
? DecorationTargetProps[P]
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 39, 16))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 42, 3))
: never
};
// Infers prop type from component C
type GetProps<C> = C extends ComponentType<infer P> ? P : never;
>GetProps : Symbol(GetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 48, 2))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 14))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 14))
>ComponentType : Symbol(ComponentType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 35, 2))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 48))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 48))
type ConnectedComponentClass<C extends ComponentType<any>, P> = ComponentClass<
>ConnectedComponentClass : Symbol(ConnectedComponentClass, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 64))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 53, 29))
>ComponentType : Symbol(ComponentType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 35, 2))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 53, 58))
>ComponentClass : Symbol(ComponentClass, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 4, 1))
P
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 53, 58))
> & {
WrappedComponent: C;
>WrappedComponent : Symbol(WrappedComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 55, 5))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 53, 29))
};
type Matching<InjectedProps, DecorationTargetProps> = {
>Matching : Symbol(Matching, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 57, 2))
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 14))
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 28))
[P in keyof DecorationTargetProps]: P extends keyof InjectedProps
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 28))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 14))
? InjectedProps[P] extends DecorationTargetProps[P]
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 14))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 28))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
? DecorationTargetProps[P]
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 28))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
: InjectedProps[P]
>InjectedProps : Symbol(InjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 14))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
: DecorationTargetProps[P]
>DecorationTargetProps : Symbol(DecorationTargetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 59, 28))
>P : Symbol(P, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 60, 3))
};
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
>Omit : Symbol(Omit, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 65, 2))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 10))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 12))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 10))
>Pick : Symbol(Pick, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 10))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 10))
>K : Symbol(K, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 12))
type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <
>InferableComponentEnhancerWithProps : Symbol(InferableComponentEnhancerWithProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 63))
>TInjectedProps : Symbol(TInjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 41))
>TNeedsProps : Symbol(TNeedsProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 56))
C extends ComponentType<Matching<TInjectedProps, GetProps<C>>>
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
>ComponentType : Symbol(ComponentType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 35, 2))
>Matching : Symbol(Matching, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 57, 2))
>TInjectedProps : Symbol(TInjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 41))
>GetProps : Symbol(GetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 48, 2))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
>(
component: C
>component : Symbol(component, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 71, 2))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
) => ConnectedComponentClass<
>ConnectedComponentClass : Symbol(ConnectedComponentClass, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 51, 64))
C,
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
Omit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> & TNeedsProps
>Omit : Symbol(Omit, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 65, 2))
>GetProps : Symbol(GetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 48, 2))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
>Shared : Symbol(Shared, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 36, 70))
>TInjectedProps : Symbol(TInjectedProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 41))
>GetProps : Symbol(GetProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 48, 2))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 73))
>TNeedsProps : Symbol(TNeedsProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 69, 56))
>;
declare const connect: {
>connect : Symbol(connect, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 78, 13))
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
>no_state : Symbol(no_state, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 3))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 17))
>TOwnProps : Symbol(TOwnProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 38))
mapStateToProps: null | undefined,
>mapStateToProps : Symbol(mapStateToProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 55))
mapDispatchToProps: TDispatchProps
>mapDispatchToProps : Symbol(mapDispatchToProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 80, 38))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 17))
): InferableComponentEnhancerWithProps<
>InferableComponentEnhancerWithProps : Symbol(InferableComponentEnhancerWithProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 67, 63))
ResolveThunks<TDispatchProps>,
>ResolveThunks : Symbol(ResolveThunks, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 100, 19))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 17))
TOwnProps
>TOwnProps : Symbol(TOwnProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 79, 38))
>;
};
type InferThunkActionCreatorType<
>InferThunkActionCreatorType : Symbol(InferThunkActionCreatorType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 86, 2))
TActionCreator extends (...args: any[]) => any
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 88, 33))
>args : Symbol(args, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 89, 26))
> = TActionCreator extends (
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 88, 33))
...args: infer TParams
>args : Symbol(args, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 90, 28))
>TParams : Symbol(TParams, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 91, 16))
) => (...args: any[]) => infer TReturn
>args : Symbol(args, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 92, 6))
>TReturn : Symbol(TReturn, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 92, 30))
? (...args: TParams) => TReturn
>args : Symbol(args, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 93, 5))
>TParams : Symbol(TParams, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 91, 16))
>TReturn : Symbol(TReturn, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 92, 30))
: TActionCreator;
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 88, 33))
type HandleThunkActionCreator<TActionCreator> = TActionCreator extends (
>HandleThunkActionCreator : Symbol(HandleThunkActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 94, 19))
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 96, 30))
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 96, 30))
...args: any[]
>args : Symbol(args, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 96, 72))
) => any
? InferThunkActionCreatorType<TActionCreator>
>InferThunkActionCreatorType : Symbol(InferThunkActionCreatorType, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 86, 2))
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 96, 30))
: TActionCreator;
>TActionCreator : Symbol(TActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 96, 30))
type ResolveThunks<TDispatchProps> = TDispatchProps extends {
>ResolveThunks : Symbol(ResolveThunks, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 100, 19))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 102, 19))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 102, 19))
[key: string]: any;
>key : Symbol(key, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 103, 3))
}
? { [C in keyof TDispatchProps]: HandleThunkActionCreator<TDispatchProps[C]> }
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 105, 7))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 102, 19))
>HandleThunkActionCreator : Symbol(HandleThunkActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 94, 19))
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 102, 19))
>C : Symbol(C, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 105, 7))
: TDispatchProps;
>TDispatchProps : Symbol(TDispatchProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 102, 19))
interface Dispatch<A extends Action = AnyAction> {
>Dispatch : Symbol(Dispatch, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 106, 19))
>A : Symbol(A, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 108, 19))
>Action : Symbol(Action, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 110, 1))
>AnyAction : Symbol(AnyAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 113, 1))
<T extends A>(action: T): T;
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 109, 3))
>A : Symbol(A, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 108, 19))
>action : Symbol(action, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 109, 16))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 109, 3))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 109, 3))
}
interface Action<T = any> {
>Action : Symbol(Action, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 110, 1))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 111, 17))
type: T;
>type : Symbol(Action.type, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 111, 27))
>T : Symbol(T, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 111, 17))
}
interface AnyAction extends Action {
>AnyAction : Symbol(AnyAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 113, 1))
>Action : Symbol(Action, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 110, 1))
[extraProps: string]: any;
>extraProps : Symbol(extraProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 115, 3))
}
const simpleAction = (payload: boolean) => ({
>simpleAction : Symbol(simpleAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 118, 5))
>payload : Symbol(payload, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 118, 22))
type: "SIMPLE_ACTION",
>type : Symbol(type, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 118, 45))
payload
>payload : Symbol(payload, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 119, 24))
});
const thunkAction = (param1: number, param2: string) => async (
>thunkAction : Symbol(thunkAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 122, 5))
>param1 : Symbol(param1, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 122, 21))
>param2 : Symbol(param2, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 122, 36))
dispatch: Dispatch,
>dispatch : Symbol(dispatch, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 122, 63))
>Dispatch : Symbol(Dispatch, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 106, 19))
{ foo }: OwnProps
>foo : Symbol(foo, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 124, 3))
>OwnProps : Symbol(OwnProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 127, 2))
) => {
return foo;
>foo : Symbol(foo, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 124, 3))
};
interface OwnProps {
>OwnProps : Symbol(OwnProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 127, 2))
foo: string;
>foo : Symbol(OwnProps.foo, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 128, 20))
}
interface TestComponentProps extends OwnProps {
>TestComponentProps : Symbol(TestComponentProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 130, 1))
>OwnProps : Symbol(OwnProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 127, 2))
simpleAction: typeof simpleAction;
>simpleAction : Symbol(TestComponentProps.simpleAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 131, 47))
>simpleAction : Symbol(simpleAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 118, 5))
thunkAction(param1: number, param2: string): Promise<string>;
>thunkAction : Symbol(TestComponentProps.thunkAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 132, 36))
>param1 : Symbol(param1, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 133, 14))
>param2 : Symbol(param2, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 133, 29))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --))
}
class TestComponent extends Component<TestComponentProps> {}
>TestComponent : Symbol(TestComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 134, 1))
>Component : Symbol(Component, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 0, 0))
>TestComponentProps : Symbol(TestComponentProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 130, 1))
const mapDispatchToProps = { simpleAction, thunkAction };
>mapDispatchToProps : Symbol(mapDispatchToProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 136, 5))
>simpleAction : Symbol(simpleAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 136, 28))
>thunkAction : Symbol(thunkAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 136, 42))
type Q = HandleThunkActionCreator<typeof simpleAction>;
>Q : Symbol(Q, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 136, 57))
>HandleThunkActionCreator : Symbol(HandleThunkActionCreator, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 94, 19))
>simpleAction : Symbol(simpleAction, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 118, 5))
const Test1 = connect(
>Test1 : Symbol(Test1, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 140, 5))
>connect : Symbol(connect, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 78, 13))
null,
mapDispatchToProps
>mapDispatchToProps : Symbol(mapDispatchToProps, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 136, 5))
)(TestComponent);
>TestComponent : Symbol(TestComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 134, 1))
@@ -0,0 +1,288 @@
=== tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts ===
declare class Component<P> {
>Component : Component<P>
constructor(props: Readonly<P>);
>props : Readonly<P>
constructor(props: P, context?: any);
>props : P
>context : any
readonly props: Readonly<P> & Readonly<{ children?: {} }>;
>props : Readonly<P> & Readonly<{ children?: {} | undefined; }>
>children : {} | undefined
}
interface ComponentClass<P = {}> {
new (props: P, context?: any): Component<P>;
>props : P
>context : any
propTypes?: WeakValidationMap<P>;
>propTypes : WeakValidationMap<P> | undefined
defaultProps?: Partial<P>;
>defaultProps : Partial<P> | undefined
displayName?: string;
>displayName : string | undefined
}
interface FunctionComponent<P = {}> {
(props: P & { children?: {} }, context?: any): {} | null;
>props : P & { children?: {} | undefined; }
>children : {} | undefined
>context : any
>null : null
propTypes?: WeakValidationMap<P>;
>propTypes : WeakValidationMap<P> | undefined
defaultProps?: Partial<P>;
>defaultProps : Partial<P> | undefined
displayName?: string;
>displayName : string | undefined
}
declare const nominalTypeHack: unique symbol;
>nominalTypeHack : unique symbol
interface Validator<T> {
(
props: object,
>props : object
propName: string,
>propName : string
componentName: string,
>componentName : string
location: string,
>location : string
propFullName: string
>propFullName : string
): Error | null;
>null : null
[nominalTypeHack]?: T;
>[nominalTypeHack] : T | undefined
>nominalTypeHack : unique symbol
}
type WeakValidationMap<T> = {
>WeakValidationMap : WeakValidationMap<T>
[K in keyof T]?: null extends T[K]
>null : null
? Validator<T[K] | null | undefined>
>null : null
: undefined extends T[K]
? Validator<T[K] | null | undefined>
>null : null
: Validator<T[K]>
};
type ComponentType<P = {}> = ComponentClass<P> | FunctionComponent<P>;
>ComponentType : ComponentType<P>
type Shared<
>Shared : Shared<InjectedProps, DecorationTargetProps>
InjectedProps,
DecorationTargetProps extends Shared<InjectedProps, DecorationTargetProps>
> = {
[P in Extract<
keyof InjectedProps,
keyof DecorationTargetProps
>]?: InjectedProps[P] extends DecorationTargetProps[P]
? DecorationTargetProps[P]
: never
};
// Infers prop type from component C
type GetProps<C> = C extends ComponentType<infer P> ? P : never;
>GetProps : GetProps<C>
type ConnectedComponentClass<C extends ComponentType<any>, P> = ComponentClass<
>ConnectedComponentClass : ConnectedComponentClass<C, P>
P
> & {
WrappedComponent: C;
>WrappedComponent : C
};
type Matching<InjectedProps, DecorationTargetProps> = {
>Matching : Matching<InjectedProps, DecorationTargetProps>
[P in keyof DecorationTargetProps]: P extends keyof InjectedProps
? InjectedProps[P] extends DecorationTargetProps[P]
? DecorationTargetProps[P]
: InjectedProps[P]
: DecorationTargetProps[P]
};
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
>Omit : Pick<T, Exclude<keyof T, K>>
type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <
>InferableComponentEnhancerWithProps : InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps>
C extends ComponentType<Matching<TInjectedProps, GetProps<C>>>
>(
component: C
>component : C
) => ConnectedComponentClass<
C,
Omit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> & TNeedsProps
>;
declare const connect: {
>connect : <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps) => InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>
<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
mapStateToProps: null | undefined,
>mapStateToProps : null | undefined
>null : null
mapDispatchToProps: TDispatchProps
>mapDispatchToProps : TDispatchProps
): InferableComponentEnhancerWithProps<
ResolveThunks<TDispatchProps>,
TOwnProps
>;
};
type InferThunkActionCreatorType<
>InferThunkActionCreatorType : InferThunkActionCreatorType<TActionCreator>
TActionCreator extends (...args: any[]) => any
>args : any[]
> = TActionCreator extends (
...args: infer TParams
>args : TParams
) => (...args: any[]) => infer TReturn
>args : any[]
? (...args: TParams) => TReturn
>args : TParams
: TActionCreator;
type HandleThunkActionCreator<TActionCreator> = TActionCreator extends (
>HandleThunkActionCreator : HandleThunkActionCreator<TActionCreator>
...args: any[]
>args : any[]
) => any
? InferThunkActionCreatorType<TActionCreator>
: TActionCreator;
type ResolveThunks<TDispatchProps> = TDispatchProps extends {
>ResolveThunks : ResolveThunks<TDispatchProps>
[key: string]: any;
>key : string
}
? { [C in keyof TDispatchProps]: HandleThunkActionCreator<TDispatchProps[C]> }
: TDispatchProps;
interface Dispatch<A extends Action = AnyAction> {
<T extends A>(action: T): T;
>action : T
}
interface Action<T = any> {
type: T;
>type : T
}
interface AnyAction extends Action {
[extraProps: string]: any;
>extraProps : string
}
const simpleAction = (payload: boolean) => ({
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
>(payload: boolean) => ({ type: "SIMPLE_ACTION", payload}) : (payload: boolean) => { type: string; payload: boolean; }
>payload : boolean
>({ type: "SIMPLE_ACTION", payload}) : { type: string; payload: boolean; }
>{ type: "SIMPLE_ACTION", payload} : { type: string; payload: boolean; }
type: "SIMPLE_ACTION",
>type : string
>"SIMPLE_ACTION" : "SIMPLE_ACTION"
payload
>payload : boolean
});
const thunkAction = (param1: number, param2: string) => async (
>thunkAction : (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>
>(param1: number, param2: string) => async ( dispatch: Dispatch, { foo }: OwnProps) => { return foo;} : (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>
>param1 : number
>param2 : string
>async ( dispatch: Dispatch, { foo }: OwnProps) => { return foo;} : (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>
dispatch: Dispatch,
>dispatch : Dispatch<AnyAction>
{ foo }: OwnProps
>foo : string
) => {
return foo;
>foo : string
};
interface OwnProps {
foo: string;
>foo : string
}
interface TestComponentProps extends OwnProps {
simpleAction: typeof simpleAction;
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
thunkAction(param1: number, param2: string): Promise<string>;
>thunkAction : (param1: number, param2: string) => Promise<string>
>param1 : number
>param2 : string
}
class TestComponent extends Component<TestComponentProps> {}
>TestComponent : TestComponent
>Component : Component<TestComponentProps>
const mapDispatchToProps = { simpleAction, thunkAction };
>mapDispatchToProps : { simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>; }
>{ simpleAction, thunkAction } : { simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>; }
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
>thunkAction : (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>
type Q = HandleThunkActionCreator<typeof simpleAction>;
>Q : (payload: boolean) => { type: string; payload: boolean; }
>simpleAction : (payload: boolean) => { type: string; payload: boolean; }
const Test1 = connect(
>Test1 : ConnectedComponentClass<typeof TestComponent, Pick<TestComponentProps, "foo">>
>connect( null, mapDispatchToProps)(TestComponent) : ConnectedComponentClass<typeof TestComponent, Pick<TestComponentProps, "foo">>
>connect( null, mapDispatchToProps) : InferableComponentEnhancerWithProps<{ simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => Promise<string>; }, {}>
>connect : <no_state = {}, TDispatchProps = {}, TOwnProps = {}>(mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps) => InferableComponentEnhancerWithProps<ResolveThunks<TDispatchProps>, TOwnProps>
null,
>null : null
mapDispatchToProps
>mapDispatchToProps : { simpleAction: (payload: boolean) => { type: string; payload: boolean; }; thunkAction: (param1: number, param2: string) => (dispatch: Dispatch<AnyAction>, { foo }: OwnProps) => Promise<string>; }
)(TestComponent);
>TestComponent : typeof TestComponent
@@ -1,13 +1,16 @@
tests/cases/compiler/recursiveResolveTypeMembers.ts(4,49): error TS2577: Return type annotation circularly references itself.
tests/cases/compiler/recursiveResolveTypeMembers.ts(4,58): error TS2304: Cannot find name 'H'.
tests/cases/compiler/recursiveResolveTypeMembers.ts(4,62): error TS2574: A rest element type must be an array type.
tests/cases/compiler/recursiveResolveTypeMembers.ts(4,79): error TS2304: Cannot find name 'R'.
==== tests/cases/compiler/recursiveResolveTypeMembers.ts (3 errors) ====
==== tests/cases/compiler/recursiveResolveTypeMembers.ts (4 errors) ====
// Repro from #25291
type PromisedTuple<L extends any[], U = (...args: L) => void> =
U extends (h: infer H, ...args: infer R) => [Promise<H>, ...PromisedTuple<R>] ? [] : []
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2577: Return type annotation circularly references itself.
~
!!! error TS2304: Cannot find name 'H'.
~~~~~~~~~~~~~~~~~~~
@@ -1,7 +1,8 @@
tests/cases/compiler/redefineArray.ts(1,1): error TS2588: Cannot assign to 'Array' because it is a constant.
tests/cases/compiler/redefineArray.ts(1,1): error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
==== tests/cases/compiler/redefineArray.ts (1 errors) ====
Array = function (n:number, s:string) {return n;};
~~~~~
!!! error TS2588: Cannot assign to 'Array' because it is a constant.
!!! error TS2741: Property 'isArray' is missing in type '(n: number, s: string) => number' but required in type 'ArrayConstructor'.
!!! related TS2728 /.ts/lib.es5.d.ts:1364:5: 'isArray' is declared here.
@@ -1,7 +1,7 @@
=== tests/cases/compiler/redefineArray.ts ===
Array = function (n:number, s:string) {return n;};
>Array = function (n:number, s:string) {return n;} : (n: number, s: string) => number
>Array : any
>Array : ArrayConstructor
>function (n:number, s:string) {return n;} : (n: number, s: string) => number
>n : number
>s : string
@@ -19,7 +19,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error
$ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
//CHECK#2
@@ -28,7 +28,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.2_A1.5_T2.ts(20,3): error
$ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
@@ -21,7 +21,7 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.3_A1.1_T2.ts(17,3): error
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
@@ -50,70 +50,70 @@ tests/cases/conformance/scanner/ecmascript5/scannerS7.6_A4.2_T1.ts(142,3): error
$ERROR('#А');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0411 = 1;
if (Б !== 1) {
$ERROR('#Б');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0412 = 1;
if (В !== 1) {
$ERROR('#В');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0413 = 1;
if (Г !== 1) {
$ERROR('#Г');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0414 = 1;
if (Д !== 1) {
$ERROR('#Д');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0415 = 1;
if (Е !== 1) {
$ERROR('#Е');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0416 = 1;
if (Ж !== 1) {
$ERROR('#Ж');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0417 = 1;
if (З !== 1) {
$ERROR('#З');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0418 = 1;
if (И !== 1) {
$ERROR('#И');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u0419 = 1;
if (Й !== 1) {
$ERROR('#Й');
~~~~~~
!!! error TS2552: Cannot find name '$ERROR'. Did you mean 'Error'?
!!! related TS2728 /.ts/lib.es5.d.ts:984:15: 'Error' is declared here.
!!! related TS2728 /.ts/lib.es5.d.ts:984:13: 'Error' is declared here.
}
var \u041A = 1;
if (К !== 1) {
@@ -0,0 +1,16 @@
tests/cases/compiler/QSpinner.js(3,1): error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
==== tests/cases/compiler/QSpinner.js (1 errors) ====
import DefaultSpinner from './QSpinner'
export default {
~~~~~~~~~~~~~~~~
mixins: [DefaultSpinner],
~~~~~~~~~~~~~~~~~~~~~~~~~~~
name: 'QSpinner'
~~~~~~~~~~~~~~~~~~
}
~
!!! error TS7022: 'default' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
@@ -0,0 +1,17 @@
//// [QSpinner.js]
import DefaultSpinner from './QSpinner'
export default {
mixins: [DefaultSpinner],
name: 'QSpinner'
}
//// [QSpinner.js]
"use strict";
exports.__esModule = true;
var QSpinner_1 = require("./QSpinner");
exports["default"] = {
mixins: [QSpinner_1["default"]],
name: 'QSpinner'
};
@@ -0,0 +1,13 @@
=== tests/cases/compiler/QSpinner.js ===
import DefaultSpinner from './QSpinner'
>DefaultSpinner : Symbol(DefaultSpinner, Decl(QSpinner.js, 0, 6))
export default {
mixins: [DefaultSpinner],
>mixins : Symbol(mixins, Decl(QSpinner.js, 2, 16))
>DefaultSpinner : Symbol(DefaultSpinner, Decl(QSpinner.js, 0, 6))
name: 'QSpinner'
>name : Symbol(name, Decl(QSpinner.js, 3, 27))
}
@@ -0,0 +1,17 @@
=== tests/cases/compiler/QSpinner.js ===
import DefaultSpinner from './QSpinner'
>DefaultSpinner : any
export default {
>{ mixins: [DefaultSpinner], name: 'QSpinner'} : { mixins: any[]; name: string; }
mixins: [DefaultSpinner],
>mixins : any[]
>[DefaultSpinner] : any[]
>DefaultSpinner : any
name: 'QSpinner'
>name : string
>'QSpinner' : "QSpinner"
}
@@ -0,0 +1,10 @@
//// [substitutionTypesCompareCorrectlyInRestrictiveInstances.ts]
type UnionKeys<T> = T extends any ? keyof T : never;
type BugHelper<T, TAll> = T extends any ? Exclude<UnionKeys<TAll>, keyof T> : never
type Bug<TAll> = BugHelper<TAll, TAll>
type Q = UnionKeys<{ a : any } | { b: any }> // should be "a" | "b"
type R = Bug<{ a : any } | { b: any }> // should be "a" | "b"
//// [substitutionTypesCompareCorrectlyInRestrictiveInstances.js]
"use strict";
@@ -0,0 +1,36 @@
=== tests/cases/compiler/substitutionTypesCompareCorrectlyInRestrictiveInstances.ts ===
type UnionKeys<T> = T extends any ? keyof T : never;
>UnionKeys : Symbol(UnionKeys, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 0))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 15))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 15))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 15))
type BugHelper<T, TAll> = T extends any ? Exclude<UnionKeys<TAll>, keyof T> : never
>BugHelper : Symbol(BugHelper, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 52))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 15))
>TAll : Symbol(TAll, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 17))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 15))
>Exclude : Symbol(Exclude, Decl(lib.es5.d.ts, --, --))
>UnionKeys : Symbol(UnionKeys, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 0))
>TAll : Symbol(TAll, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 17))
>T : Symbol(T, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 15))
type Bug<TAll> = BugHelper<TAll, TAll>
>Bug : Symbol(Bug, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 83))
>TAll : Symbol(TAll, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 2, 9))
>BugHelper : Symbol(BugHelper, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 52))
>TAll : Symbol(TAll, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 2, 9))
>TAll : Symbol(TAll, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 2, 9))
type Q = UnionKeys<{ a : any } | { b: any }> // should be "a" | "b"
>Q : Symbol(Q, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 2, 39))
>UnionKeys : Symbol(UnionKeys, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 0, 0))
>a : Symbol(a, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 3, 20))
>b : Symbol(b, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 3, 34))
type R = Bug<{ a : any } | { b: any }> // should be "a" | "b"
>R : Symbol(R, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 3, 44))
>Bug : Symbol(Bug, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 1, 83))
>a : Symbol(a, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 4, 14))
>b : Symbol(b, Decl(substitutionTypesCompareCorrectlyInRestrictiveInstances.ts, 4, 28))
@@ -0,0 +1,20 @@
=== tests/cases/compiler/substitutionTypesCompareCorrectlyInRestrictiveInstances.ts ===
type UnionKeys<T> = T extends any ? keyof T : never;
>UnionKeys : UnionKeys<T>
type BugHelper<T, TAll> = T extends any ? Exclude<UnionKeys<TAll>, keyof T> : never
>BugHelper : BugHelper<T, TAll>
type Bug<TAll> = BugHelper<TAll, TAll>
>Bug : BugHelper<TAll, TAll>
type Q = UnionKeys<{ a : any } | { b: any }> // should be "a" | "b"
>Q : "a" | "b"
>a : any
>b : any
type R = Bug<{ a : any } | { b: any }> // should be "a" | "b"
>R : "a" | "b"
>a : any
>b : any
@@ -0,0 +1,206 @@
tests/cases/conformance/types/thisType/thisTypeInFunctions.ts(118,29): error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
tests/cases/conformance/types/thisType/thisTypeInFunctions.ts(119,32): error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
tests/cases/conformance/types/thisType/thisTypeInFunctions.ts(120,36): error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
==== tests/cases/conformance/types/thisType/thisTypeInFunctions.ts (3 errors) ====
// body checking
class B {
n: number;
}
class C {
n: number;
explicitThis(this: this, m: number): number {
return this.n + m;
}
explicitC(this: C, m: number): number {
return this.n + m;
}
explicitProperty(this: {n: number}, m: number): number {
return this.n + m;
}
explicitVoid(this: void, m: number): number {
return m + 1;
}
}
class D extends C { }
interface I {
a: number;
explicitVoid1(this: void): number;
explicitVoid2(this: void): number;
explicitStructural(this: {a: number}): number;
explicitInterface(this: I): number;
explicitThis(this: this): number;
}
function explicitStructural(this: { y: number }, x: number): number {
return x + this.y;
}
function justThis(this: { y: number }): number {
return this.y;
}
function implicitThis(n: number): number {
return this.m + n + 12;
}
let impl: I = {
a: 12,
explicitVoid2: () => this.a, // ok, this: any because it refers to some outer object (window?)
explicitVoid1() { return 12; },
explicitStructural() {
return this.a;
},
explicitInterface() {
return this.a;
},
explicitThis() {
return this.a;
},
}
impl.explicitVoid1 = function () { return 12; };
impl.explicitVoid2 = () => 12;
impl.explicitStructural = function() { return this.a; };
impl.explicitInterface = function() { return this.a; };
impl.explicitStructural = () => 12;
impl.explicitInterface = () => 12;
impl.explicitThis = function () { return this.a; };
// parameter checking
let ok: {y: number, f: (this: { y: number }, x: number) => number} = { y: 12, f: explicitStructural };
let implicitAnyOk: {notSpecified: number, f: (x: number) => number} = { notSpecified: 12, f: implicitThis };
ok.f(13);
implicitThis(12);
implicitAnyOk.f(12);
let c = new C();
let d = new D();
let ripped = c.explicitC;
c.explicitC(12);
c.explicitProperty(12);
c.explicitThis(12);
d.explicitC(12);
d.explicitProperty(12);
d.explicitThis(12);
let reconstructed: {
n: number,
explicitThis(this: C, m: number): number, // note: this: this is not allowed in an object literal type.
explicitC(this: C, m: number): number,
explicitProperty: (this: {n : number}, m: number) => number,
explicitVoid(this: void, m: number): number,
} = {
n: 12,
explicitThis: c.explicitThis,
explicitC: c.explicitC,
explicitProperty: c.explicitProperty,
explicitVoid: c.explicitVoid
};
reconstructed.explicitThis(10);
reconstructed.explicitProperty(11);
let explicitVoid = reconstructed.explicitVoid;
explicitVoid(12);
// assignment checking
let unboundToSpecified: (this: { y: number }, x: number) => number = x => x + this.y; // ok, this:any
let specifiedToSpecified: (this: {y: number}, x: number) => number = explicitStructural;
let anyToSpecified: (this: { y: number }, x: number) => number = function(x: number): number { return x + 12; };
let unspecifiedLambda: (x: number) => number = x => x + 12;
let specifiedLambda: (this: void, x: number) => number = x => x + 12;
let unspecifiedLambdaToSpecified: (this: {y: number}, x: number) => number = unspecifiedLambda;
let specifiedLambdaToSpecified: (this: {y: number}, x: number) => number = specifiedLambda;
let explicitCFunction: (this: C, m: number) => number;
let explicitPropertyFunction: (this: {n: number}, m: number) => number;
c.explicitC = explicitCFunction;
c.explicitC = function(this: C, m: number) { return this.n + m };
c.explicitProperty = explicitPropertyFunction;
c.explicitProperty = function(this: {n: number}, m: number) { return this.n + m };
c.explicitProperty = reconstructed.explicitProperty;
// lambdas are assignable to anything
c.explicitC = m => m;
c.explicitThis = m => m;
c.explicitProperty = m => m;
// this inside lambdas refer to outer scope
// the outer-scoped lambda at top-level is still just `any`
c.explicitC = m => m + this.n;
~
!!! error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
c.explicitThis = m => m + this.n;
~
!!! error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
c.explicitProperty = m => m + this.n;
~
!!! error TS2339: Property 'n' does not exist on type 'typeof globalThis'.
//NOTE: this=C here, I guess?
c.explicitThis = explicitCFunction;
c.explicitThis = function(this: C, m: number) { return this.n + m };
// this:any compatibility
c.explicitC = function(m) { return this.n + m };
c.explicitProperty = function(m) { return this.n + m };
c.explicitThis = function(m) { return this.n + m };
// this: contextual typing
c.explicitThis = function(this, m) { return this.n + m };
// this: superclass compatibility
c.explicitC = function(this: B, m: number) { return this.n + m };
// this:void compatibility
c.explicitVoid = n => n;
// class-based assignability
class Base1 {
x: number;
public polymorphic(this: this): number { return this.x; }
explicit(this: Base1): number { return this.x; }
static explicitStatic(this: typeof Base1): number { return this.y; }
static y: number;
}
class Derived1 extends Base1 {
y: number
}
class Base2 {
y: number
polymorphic(this: this): number { return this.y; }
explicit(this: Base1): number { return this.x; }
}
class Derived2 extends Base2 {
x: number
}
let b1 = new Base1();
let b2 = new Base2();
let d1 = new Derived1();
let d2 = new Derived2();
d2.polymorphic = d1.polymorphic // ok, 'x' and 'y' in { x, y }
d1.polymorphic = d2.polymorphic // ok, 'x' and 'y' in { x, y }
// bivariance-allowed cases
d1.polymorphic = b2.polymorphic // ok, 'y' in D: { x, y }
d2.polymorphic = d1.explicit // ok, 'y' in { x, y }
b1.polymorphic = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
b1.explicit = d2.polymorphic // ok, 'x' and 'y' not in Base1: { x }
////// use this-type for construction with new ////
function InterfaceThis(this: I) {
this.a = 12;
}
function LiteralTypeThis(this: {x: string}) {
this.x = "ok";
}
function AnyThis(this: any) {
this.x = "ok";
}
let interfaceThis = new InterfaceThis();
let literalTypeThis = new LiteralTypeThis();
let anyThis = new AnyThis();
//// type parameter inference ////
declare var f: {
(this: void, x: number): number,
call<U>(this: (...argArray: any[]) => U, ...argArray: any[]): U;
};
let n: number = f.call(12);
function missingTypeIsImplicitAny(this, a: number) { return this.anything + a; }
@@ -497,9 +497,7 @@ c.explicitC = m => m + this.n;
>explicitC : Symbol(C.explicitC, Decl(thisTypeInFunctions.ts, 8, 5))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 117, 13))
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
>this : Symbol(globalThis)
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
c.explicitThis = m => m + this.n;
>c.explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14))
@@ -507,9 +505,7 @@ c.explicitThis = m => m + this.n;
>explicitThis : Symbol(C.explicitThis, Decl(thisTypeInFunctions.ts, 5, 14))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 118, 16))
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
>this : Symbol(globalThis)
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
c.explicitProperty = m => m + this.n;
>c.explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5))
@@ -517,9 +513,7 @@ c.explicitProperty = m => m + this.n;
>explicitProperty : Symbol(C.explicitProperty, Decl(thisTypeInFunctions.ts, 11, 5))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20))
>m : Symbol(m, Decl(thisTypeInFunctions.ts, 119, 20))
>this.n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
>this : Symbol(globalThis)
>n : Symbol(n, Decl(thisTypeInFunctions.ts, 190, 3))
//NOTE: this=C here, I guess?
c.explicitThis = explicitCFunction;
@@ -580,43 +580,43 @@ c.explicitProperty = m => m;
// this inside lambdas refer to outer scope
// the outer-scoped lambda at top-level is still just `any`
c.explicitC = m => m + this.n;
>c.explicitC = m => m + this.n : (this: C, m: number) => number
>c.explicitC = m => m + this.n : (this: C, m: number) => any
>c.explicitC : (this: C, m: number) => number
>c : C
>explicitC : (this: C, m: number) => number
>m => m + this.n : (this: C, m: number) => number
>m => m + this.n : (this: C, m: number) => any
>m : number
>m + this.n : number
>m + this.n : any
>m : number
>this.n : number
>this.n : any
>this : typeof globalThis
>n : number
>n : any
c.explicitThis = m => m + this.n;
>c.explicitThis = m => m + this.n : (this: C, m: number) => number
>c.explicitThis = m => m + this.n : (this: C, m: number) => any
>c.explicitThis : (this: C, m: number) => number
>c : C
>explicitThis : (this: C, m: number) => number
>m => m + this.n : (this: C, m: number) => number
>m => m + this.n : (this: C, m: number) => any
>m : number
>m + this.n : number
>m + this.n : any
>m : number
>this.n : number
>this.n : any
>this : typeof globalThis
>n : number
>n : any
c.explicitProperty = m => m + this.n;
>c.explicitProperty = m => m + this.n : (this: { n: number; }, m: number) => number
>c.explicitProperty = m => m + this.n : (this: { n: number; }, m: number) => any
>c.explicitProperty : (this: { n: number; }, m: number) => number
>c : C
>explicitProperty : (this: { n: number; }, m: number) => number
>m => m + this.n : (this: { n: number; }, m: number) => number
>m => m + this.n : (this: { n: number; }, m: number) => any
>m : number
>m + this.n : number
>m + this.n : any
>m : number
>this.n : number
>this.n : any
>this : typeof globalThis
>n : number
>n : any
//NOTE: this=C here, I guess?
c.explicitThis = explicitCFunction;
@@ -1,6 +1,9 @@
Exit Code: 1
Standard output:
node_modules/@types/passport-facebook/index.d.ts(50,31): error TS2689: Cannot extend an interface 'passport.Strategy'. Did you mean 'implements'?
src/controllers/user.ts(95,5): error TS2345: Argument of type '{ email: any; password: any; }' is not assignable to parameter of type 'Partial<Document>'.
Object literal may only specify known properties, and 'email' does not exist in type 'Partial<Document>'.
src/controllers/user.ts(105,16): error TS7006: Parameter 'err' implicitly has an 'any' type.
@@ -19,6 +19,7 @@ node_modules/adonis-framework/src/Config/index.js(37,15): error TS2304: Cannot f
node_modules/adonis-framework/src/Config/index.js(39,15): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Config/index.js(58,15): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Encryption/index.js(53,15): error TS2304: Cannot find name 'Mixed'.
node_modules/adonis-framework/src/Encryption/index.js(71,34): error TS2345: Argument of type 'string' is not assignable to parameter of type '"utf8" | "ascii" | "binary" | undefined'.
node_modules/adonis-framework/src/Encryption/index.js(77,50): error TS2345: Argument of type 'Buffer' is not assignable to parameter of type 'string'.
node_modules/adonis-framework/src/Encryption/index.js(85,23): error TS8024: JSDoc '@param' tag has name 'value', but there is no parameter with that name.
node_modules/adonis-framework/src/Encryption/index.js(87,15): error TS2304: Cannot find name 'Mixed'.
@@ -49,21 +50,21 @@ node_modules/adonis-framework/src/Event/index.js(271,25): error TS2345: Argument
node_modules/adonis-framework/src/Event/index.js(278,25): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type '[string, any, TimerHandler]'.
node_modules/adonis-framework/src/Event/index.js(294,30): error TS2345: Argument of type 'Function' is not assignable to parameter of type 'Listener'.
node_modules/adonis-framework/src/Exceptions/index.js(13,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
node_modules/adonis-framework/src/Exceptions/index.js(27,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(40,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(52,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(63,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(75,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(87,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(99,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(112,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(125,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(138,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(151,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(27,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(40,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(52,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(63,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(75,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(87,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(99,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(112,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(125,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(138,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(151,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(164,14): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
node_modules/adonis-framework/src/Exceptions/index.js(178,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(191,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(205,12): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(178,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(191,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/Exceptions/index.js(205,21): error TS2554: Expected 0 arguments, but got 3.
node_modules/adonis-framework/src/File/index.js(175,5): error TS2322: Type 'Promise<any>' is not assignable to type 'boolean'.
node_modules/adonis-framework/src/File/index.js(273,5): error TS2322: Type 'boolean | ""' is not assignable to type 'boolean'.
Type '""' is not assignable to type 'boolean'.
@@ -135,7 +136,7 @@ node_modules/adonis-framework/src/Route/index.js(333,29): error TS2345: Argument
node_modules/adonis-framework/src/Route/index.js(343,33): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'.
node_modules/adonis-framework/src/Route/index.js(354,20): error TS2694: Namespace 'Route' has no exported member 'Group'.
node_modules/adonis-framework/src/Route/index.js(368,3): error TS2322: Type 'null' is not assignable to type 'string'.
node_modules/adonis-framework/src/Route/index.js(396,10): error TS2554: Expected 2 arguments, but got 3.
node_modules/adonis-framework/src/Route/index.js(396,63): error TS2554: Expected 2 arguments, but got 3.
node_modules/adonis-framework/src/Route/index.js(407,20): error TS2694: Namespace 'Route' has no exported member 'resources'.
node_modules/adonis-framework/src/Route/index.js(501,42): error TS2345: Argument of type 'boolean | undefined' is not assignable to parameter of type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.
+1 -1
View File
@@ -123,7 +123,7 @@ node_modules/async/dist/async.js(1951,10): error TS8024: JSDoc '@param' tag has
node_modules/async/dist/async.js(1990,16): error TS2554: Expected 3 arguments, but got 1.
node_modules/async/dist/async.js(2116,20): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'number | undefined'.
Type 'Function' is not assignable to type 'number'.
node_modules/async/dist/async.js(2274,21): error TS2554: Expected 0 arguments, but got 2.
node_modules/async/dist/async.js(2274,29): error TS2554: Expected 0 arguments, but got 2.
node_modules/async/dist/async.js(2425,20): error TS1005: '}' expected.
node_modules/async/dist/async.js(2450,5): error TS2740: Type '{ _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturated: () => void; buffer: number; empty: () => void; drain: () => void; error: () => void; started: boolean; paused: boolean; push: (data: any, callback: any) => void; ... 9 more ...; resume: () => void; }' is missing the following properties from type 'NodeModule': exports, require, id, filename, and 4 more.
node_modules/async/dist/async.js(2521,9): error TS2722: Cannot invoke an object which is possibly 'undefined'.
+9 -9
View File
@@ -14,7 +14,7 @@ node_modules/bluebird/js/release/bluebird.js(10,10): error TS2339: Property 'noC
node_modules/bluebird/js/release/call_get.js(11,24): error TS2339: Property 'canEvaluate' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/call_get.js(12,25): error TS2339: Property 'isIdentifier' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/call_get.js(73,40): error TS2339: Property 'classString' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/call_get.js(74,13): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/call_get.js(74,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/cancel.js(4,21): error TS2339: Property 'tryCatch' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/cancel.js(5,21): error TS2339: Property 'errorObj' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/cancel.js(93,14): error TS2339: Property 'isArray' does not exist on type 'typeof ret'.
@@ -50,14 +50,14 @@ node_modules/bluebird/js/release/debuggability.js(211,31): error TS2339: Propert
node_modules/bluebird/js/release/debuggability.js(242,56): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'.
Type 'IArguments' is missing the following properties from type 'any[]': pop, push, concat, join, and 26 more.
node_modules/bluebird/js/release/debuggability.js(274,18): error TS2339: Property 'isObject' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(338,37): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(338,51): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(352,18): error TS2339: Property 'isArray' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(424,18): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(426,18): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(491,19): error TS2350: Only a void function can be called with the 'new' keyword.
node_modules/bluebird/js/release/debuggability.js(562,46): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(562,59): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(601,18): error TS2339: Property 'isObject' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(648,32): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(648,46): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(736,5): error TS2721: Cannot invoke an object which is possibly 'null'.
node_modules/bluebird/js/release/debuggability.js(739,6): error TS2339: Property 'inherits' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(754,30): error TS2339: Property 'stack' does not exist on type 'CapturedTrace'.
@@ -65,7 +65,7 @@ node_modules/bluebird/js/release/debuggability.js(760,37): error TS2339: Propert
node_modules/bluebird/js/release/debuggability.js(799,38): error TS2339: Property 'stack' does not exist on type 'CapturedTrace'.
node_modules/bluebird/js/release/debuggability.js(804,10): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(805,10): error TS2339: Property 'notEnumerableProp' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(808,25): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(879,4): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/debuggability.js(885,14): error TS2339: Property 'isNode' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/debuggability.js(890,22): error TS2339: Property 'isNode' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/errors.js(5,21): error TS2339: Property 'inherits' does not exist on type 'typeof ret'.
@@ -81,7 +81,7 @@ node_modules/bluebird/js/release/generators.js(159,21): error TS2350: Only a voi
node_modules/bluebird/js/release/generators.js(190,15): error TS2350: Only a void function can be called with the 'new' keyword.
node_modules/bluebird/js/release/generators.js(208,15): error TS2350: Only a void function can be called with the 'new' keyword.
node_modules/bluebird/js/release/generators.js(208,68): error TS2339: Property 'classString' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/generators.js(220,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/generators.js(220,16): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/join.js(6,24): error TS2339: Property 'canEvaluate' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/join.js(7,21): error TS2339: Property 'tryCatch' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/join.js(8,21): error TS2339: Property 'errorObj' does not exist on type 'typeof ret'.
@@ -191,8 +191,8 @@ node_modules/bluebird/js/release/promise_array.js(26,6): error TS2339: Property
node_modules/bluebird/js/release/promise_array.js(61,19): error TS2339: Property 'asArray' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promise_array.js(64,72): error TS2339: Property 'classString' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promise_array.js(71,18): error TS2339: Property '_resolveEmptyArray' does not exist on type 'PromiseArray'.
node_modules/bluebird/js/release/promise_array.js(109,30): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/bluebird/js/release/promise_array.js(111,30): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/promise_array.js(109,76): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/bluebird/js/release/promise_array.js(111,53): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/promisify.js(6,25): error TS2339: Property 'withAppended' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promisify.js(7,29): error TS2339: Property 'maybeWrapAsError' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promisify.js(8,24): error TS2339: Property 'canEvaluate' does not exist on type 'typeof ret'.
@@ -200,7 +200,7 @@ node_modules/bluebird/js/release/promisify.js(24,17): error TS2339: Property 'is
node_modules/bluebird/js/release/promisify.js(43,20): error TS2339: Property 'getDataPropertyOrDefault' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promisify.js(54,27): error TS2350: Only a void function can be called with the 'new' keyword.
node_modules/bluebird/js/release/promisify.js(63,21): error TS2339: Property 'inheritedDataKeys' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promisify.js(69,22): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/bluebird/js/release/promisify.js(69,41): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/bluebird/js/release/promisify.js(93,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'any'.
node_modules/bluebird/js/release/promisify.js(100,17): error TS2339: Property 'filledRange' does not exist on type 'typeof ret'.
node_modules/bluebird/js/release/promisify.js(104,17): error TS2339: Property 'filledRange' does not exist on type 'typeof ret'.
@@ -47,7 +47,7 @@ node_modules/chrome-devtools-frontend/front_end/Tests.js(416,5): error TS2554: E
node_modules/chrome-devtools-frontend/front_end/Tests.js(440,5): error TS2554: Expected 4 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/Tests.js(475,5): error TS2554: Expected 4 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/Tests.js(571,33): error TS2339: Property 'deprecatedRunAfterPendingDispatches' does not exist on type 'typeof InspectorBackend'.
node_modules/chrome-devtools-frontend/front_end/Tests.js(590,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/Tests.js(590,57): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/Tests.js(619,44): error TS2339: Property 'emulationAgent' does not exist on type 'Target'.
node_modules/chrome-devtools-frontend/front_end/Tests.js(666,38): error TS2339: Property 'inputAgent' does not exist on type 'Target'.
node_modules/chrome-devtools-frontend/front_end/Tests.js(668,38): error TS2339: Property 'inputAgent' does not exist on type 'Target'.
@@ -452,7 +452,7 @@ node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheSto
node_modules/chrome-devtools-frontend/front_end/application_test_runner/CacheStorageTestRunner.js(135,10): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/IndexedDBTestRunner.js(12,40): error TS2339: Property 'resources' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/IndexedDBTestRunner.js(47,42): error TS2339: Property 'resources' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/IndexedDBTestRunner.js(140,24): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/IndexedDBTestRunner.js(140,85): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/ResourceTreeTestRunner.js(69,18): error TS2339: Property 'resources' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/ResourcesTestRunner.js(76,15): error TS2339: Property 'resources' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/application_test_runner/ResourcesTestRunner.js(77,33): error TS2339: Property 'resources' does not exist on type 'any[]'.
@@ -533,7 +533,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(944,23):
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(950,47): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(952,19): error TS2304: Cannot find name 'DOM'.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(954,32): error TS2304: Cannot find name 'CategoryRenderer'.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(955,20): error TS2554: Expected 0 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(955,60): error TS2554: Expected 0 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(967,41): error TS2304: Cannot find name 'DetailsRenderer'.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(969,15): error TS2304: Cannot find name 'DOM'.
node_modules/chrome-devtools-frontend/front_end/audits2/Audits2Panel.js(978,15): error TS2503: Cannot find namespace 'DetailsRenderer'.
@@ -682,22 +682,22 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js
node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js(131,8): error TS2339: Property 'document' does not exist on type 'Global'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/Audits2Service.js(132,8): error TS2339: Property 'document' does not exist on type 'Global'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,1): error TS2739: Type '(o: any, u: any) => any' is missing the following properties from type 'NodeRequire': resolve, cache, extensions, main
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,121): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,141): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,125): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,145): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(2,203): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(5494,9): error TS2339: Property 'stableSort' does not exist on type '{ category: any; group: any; duration: any; }[]'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(5878,16): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(5879,17): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(5878,60): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(5879,62): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(6400,21): error TS2339: Property 'valuesArray' does not exist on type 'Map<any, any>'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(8112,74): error TS2339: Property 'name' does not exist on type 'ComputedArtifact'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9093,1): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9117,1): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9093,57): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9117,73): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(9467,15): error TS2339: Property 'axe' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10092,16): error TS2304: Cannot find name 'd41d8cd98f00b204e9800998ecf8427e_LibraryDetectorTests'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10513,19): error TS2488: Type 'NodeListOf<Element>' must have a '[Symbol.iterator]()' method that returns an iterator.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(10811,19): error TS2304: Cannot find name 'getElementsInDocument'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12197,22): error TS2554: Expected 0 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12327,24): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12197,34): error TS2554: Expected 0 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(12327,36): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(13607,7): error TS2339: Property 'protocolMethod' does not exist on type 'Error'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(13608,7): error TS2339: Property 'protocolError' does not exist on type 'Error'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(14352,1): error TS2722: Cannot invoke an object which is possibly 'undefined'.
@@ -731,13 +731,13 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15882,16): error TS2339: Property '_logs' does not exist on type 'typeof ConsoleQuieter'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15891,16): error TS2339: Property '_logs' does not exist on type 'typeof ConsoleQuieter'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(15894,16): error TS2339: Property '_logs' does not exist on type 'typeof ConsoleQuieter'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(16213,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(16219,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(16213,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(16219,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(16733,11): error TS2339: Property 'NodeTimingData' does not exist on type 'typeof Simulator'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(17089,26): error TS2339: Property '__proto__' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(17089,45): error TS2339: Property '__proto__' does not exist on type 'Document'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(17501,1): error TS2322: Type 'any[]' is not assignable to type 'string'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(18010,1): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(18010,29): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19499,6): error TS2339: Property 'Util' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(19585,1): error TS2322: Type 'Promise<void | { artifacts: any; auditResults: any[]; }>' is not assignable to type 'Promise<void>'.
Type 'void | { artifacts: any; auditResults: any[]; }' is not assignable to type 'void'.
@@ -886,7 +886,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28589,5): error TS2339: Property 'removeListener' does not exist on type 'Readable'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28590,5): error TS2339: Property 'removeListener' does not exist on type 'Readable'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28591,5): error TS2339: Property 'removeListener' does not exist on type 'Readable'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28746,1): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28746,19): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28797,6): error TS2339: Property 'emit' does not exist on type 'Readable'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(28855,19): error TS2339: Property 'emit' does not exist on type 'Readable'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(29117,47): error TS2300: Duplicate identifier '_transform'.
@@ -2823,7 +2823,7 @@ node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighth
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60141,1): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60144,1): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60162,11): error TS2304: Cannot find name 'WebInspector'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60222,1): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60222,51): error TS2554: Expected 0-2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60267,11): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60267,32): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/audits2_worker/lighthouse/lighthouse-background.js(60268,1): error TS2304: Cannot find name 'define'.
@@ -3517,8 +3517,8 @@ node_modules/chrome-devtools-frontend/front_end/cm_modes/coffeescript.js(11,43):
node_modules/chrome-devtools-frontend/front_end/cm_modes/coffeescript.js(12,5): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/coffeescript.js(41,3): error TS2740: Type 'RegExp' is missing the following properties from type 'string[]': length, pop, push, concat, and 28 more.
node_modules/chrome-devtools-frontend/front_end/cm_modes/coffeescript.js(282,24): error TS2339: Property 'exec' does not exist on type 'string[]'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(6,5): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(6,17): error TS2307: Cannot find module '../../lib/codemirror'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(6,42): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(6,50): error TS2307: Cannot find module '../xml/xml'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(6,73): error TS2307: Cannot find module '../javascript/javascript'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/jsx.js(7,19): error TS2304: Cannot find name 'define'.
@@ -3528,8 +3528,8 @@ node_modules/chrome-devtools-frontend/front_end/cm_modes/livescript.js(11,17): e
node_modules/chrome-devtools-frontend/front_end/cm_modes/livescript.js(12,19): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/livescript.js(12,43): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/livescript.js(13,5): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(6,5): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(6,17): error TS2307: Cannot find module '../../lib/codemirror'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(6,42): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(6,50): error TS2307: Cannot find module '../htmlmixed/htmlmixed'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(6,85): error TS2307: Cannot find module '../clike/clike'.
node_modules/chrome-devtools-frontend/front_end/cm_modes/php.js(7,19): error TS2304: Cannot find name 'define'.
@@ -3553,15 +3553,15 @@ node_modules/chrome-devtools-frontend/front_end/cm_web_modes/css.js(6,17): error
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/css.js(7,19): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/css.js(7,43): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/css.js(8,5): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(6,5): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(6,17): error TS2307: Cannot find module '../../lib/codemirror'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(6,42): error TS2554: Expected 0-1 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(6,50): error TS2307: Cannot find module '../htmlmixed/htmlmixed'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(7,17): error TS2307: Cannot find module '../../addon/mode/multiplex'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(8,19): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(8,43): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlembedded.js(9,5): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,5): error TS2554: Expected 0-1 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,17): error TS2307: Cannot find module '../../lib/codemirror'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,42): error TS2554: Expected 0-1 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,50): error TS2307: Cannot find module '../xml/xml'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,73): error TS2307: Cannot find module '../javascript/javascript'.
node_modules/chrome-devtools-frontend/front_end/cm_web_modes/htmlmixed.js(6,110): error TS2307: Cannot find module '../css/css'.
@@ -3748,7 +3748,7 @@ node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(152,25): err
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(161,25): error TS2339: Property 'asParsedURL' does not exist on type 'string'.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(211,34): error TS2339: Property 'asParsedURL' does not exist on type 'string'.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(215,29): error TS2339: Property 'asParsedURL' does not exist on type 'string'.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(318,32): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(318,49): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/common/ParsedURL.js(375,18): error TS2339: Property 'asParsedURL' does not exist on type 'String'.
node_modules/chrome-devtools-frontend/front_end/common/SegmentedRange.js(48,37): error TS2339: Property 'lowerBound' does not exist on type 'Segment[]'.
node_modules/chrome-devtools-frontend/front_end/common/Settings.js(49,10): error TS2339: Property 'runtime' does not exist on type 'Window'.
@@ -3900,7 +3900,7 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.j
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(192,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(200,22): error TS2694: Namespace 'Common' has no exported member 'Event'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(255,28): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(256,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(256,55): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(257,31): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(264,13): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleContextSelector.js(279,14): error TS2555: Expected at least 2 arguments, but got 1.
@@ -4179,7 +4179,7 @@ node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(70
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(733,19): error TS2339: Property 'removeChildren' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(735,35): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(736,31): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(750,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(750,54): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(803,34): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(804,31): error TS2339: Property 'style' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/console/ConsoleViewMessage.js(806,43): error TS2339: Property 'style' does not exist on type 'Element'.
@@ -4517,7 +4517,7 @@ node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(98,48): er
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(109,26): error TS2352: Conversion of type 'DataGridNode<any>' to type 'NODE_TYPE' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(121,17): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(123,17): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(134,29): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(134,45): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(135,15): error TS2339: Property 'title' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(139,15): error TS2339: Property 'title' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/data_grid/DataGrid.js(159,33): error TS2694: Namespace 'DataGrid.DataGrid' has no exported member 'ColumnDescriptor'.
@@ -6341,11 +6341,11 @@ node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(274,3): error TS2554: Expected 2-3 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(287,26): error TS2339: Property 'computeLineEndings' does not exist on type 'string'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(295,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'formatter' must be of type 'HTMLFormatter', but here has type 'CSSFormatter'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(296,9): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(296,45): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(299,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'formatter' must be of type 'HTMLFormatter', but here has type 'JavaScriptFormatter'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(300,9): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(300,45): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(303,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'formatter' must be of type 'HTMLFormatter', but here has type 'IdentityFormatter'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(304,9): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(304,45): error TS2554: Expected 2 arguments, but got 4.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(313,3): error TS2554: Expected 2-3 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/FormatterWorker.js(334,24): error TS2339: Property 'runtime' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/formatter_worker/HTMLFormatter.js(98,21): error TS2339: Property 'isWhitespace' does not exist on type 'string'.
@@ -7755,7 +7755,7 @@ node_modules/chrome-devtools-frontend/front_end/object_ui/JavaScriptAutocomplete
node_modules/chrome-devtools-frontend/front_end/object_ui/JavaScriptAutocomplete.js(471,33): error TS2339: Property 'CompletionGroup' does not exist on type 'typeof JavaScriptAutocomplete'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(82,35): error TS2694: Namespace 'SDK.DebuggerModel' has no exported member 'FunctionDetails'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(91,29): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(108,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(108,50): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(114,48): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(129,7): error TS2722: Cannot invoke an object which is possibly 'undefined'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPopoverHelper.js(145,50): error TS2339: Property 'createChild' does not exist on type 'Element'.
@@ -7768,7 +7768,7 @@ node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSectio
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(181,18): error TS2339: Property 'title' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(207,22): error TS2339: Property 'createChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(209,22): error TS2339: Property 'createTextChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(209,38): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(209,58): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(211,22): error TS2339: Property 'createTextChild' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(263,20): error TS2339: Property 'title' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/object_ui/ObjectPropertiesSection.js(268,22): error TS2339: Property 'setTextContentTruncatedIfNeeded' does not exist on type 'Element'.
@@ -8079,12 +8079,12 @@ node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineOverviewPane.js(
node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineOverviewPane.js(490,39): error TS2345: Argument of type 'symbol' is not assignable to parameter of type 'boolean'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineOverviewPane.js(495,14): error TS2339: Property 'createChild' does not exist on type 'DocumentFragment'.
node_modules/chrome-devtools-frontend/front_end/perf_ui/TimelineOverviewPane.js(508,61): error TS2339: Property 'boxInWindow' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(74,36): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(74,72): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(81,20): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(91,33): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(98,5): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(108,20): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(120,43): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(120,79): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(130,13): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(131,97): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(135,35): error TS2339: Property 'timeline' does not exist on type 'any[]'.
@@ -8093,7 +8093,7 @@ node_modules/chrome-devtools-frontend/front_end/performance_test_runner/Timeline
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(159,9): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(189,60): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(220,44): error TS2339: Property 'peekLast' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(254,19): error TS2554: Expected 2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(255,46): error TS2554: Expected 2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(321,53): error TS2345: Argument of type 'number' is not assignable to parameter of type 'V'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(347,30): error TS2339: Property 'timeline' does not exist on type 'any[]'.
node_modules/chrome-devtools-frontend/front_end/performance_test_runner/TimelineTestRunner.js(355,13): error TS2339: Property 'timeline' does not exist on type 'any[]'.
@@ -8309,7 +8309,7 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1277,40):
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1299,35): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1321,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1324,6): error TS2339: Property 'setImmediate' does not exist on type 'Window'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1326,32): error TS2556: Expected 0 arguments, but got 1 or more.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1326,41): error TS2556: Expected 0 arguments, but got 1 or more.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1331,12): error TS7014: Function type, which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1335,19): error TS2339: Property 'spread' does not exist on type 'Promise<any>'.
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1348,19): error TS2339: Property 'catchException' does not exist on type 'Promise<any>'.
@@ -10421,7 +10421,7 @@ node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(134,32): err
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(139,30): error TS2345: Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'string | string[]'.
Type 'TemplateStringsArray' is not assignable to type 'string[]'.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(149,24): error TS2554: Expected 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(165,32): error TS2554: Expected 2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(165,78): error TS2554: Expected 2 arguments, but got 3.
node_modules/chrome-devtools-frontend/front_end/sdk/ServerTiming.js(186,25): error TS2555: Expected at least 2 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/sdk/ServiceWorkerCacheModel.js(15,12): error TS2339: Property 'registerStorageDispatcher' does not exist on type 'Target'.
node_modules/chrome-devtools-frontend/front_end/sdk/ServiceWorkerCacheModel.js(20,31): error TS2339: Property 'cacheStorageAgent' does not exist on type 'Target'.
@@ -11055,7 +11055,7 @@ node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSid
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(80,71): error TS2339: Property 'uiLocation' does not exist on type 'V'.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(81,60): error TS2339: Property 'breakpoint' does not exist on type 'V'.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(82,62): error TS2339: Property 'breakpoint' does not exist on type 'V'.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(131,38): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(131,55): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(141,29): error TS2339: Property 'enclosingNodeOrSelfWithClass' does not exist on type 'EventTarget'.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(156,33): error TS2339: Property 'checkboxElement' does not exist on type 'EventTarget'.
node_modules/chrome-devtools-frontend/front_end/sources/JavaScriptBreakpointsSidebarPane.js(159,11): error TS2339: Property 'consume' does not exist on type 'Event'.
@@ -11544,8 +11544,8 @@ node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/addons/fit/fit
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,107): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,128): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,140): error TS2304: Cannot find name 'define'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,482): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,502): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,486): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,506): error TS2554: Expected 1 arguments, but got 2.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(1,564): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3,1): error TS2323: Cannot redeclare exported variable '__esModule'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(166,1): error TS2323: Cannot redeclare exported variable '__esModule'.
@@ -11617,12 +11617,12 @@ node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3498,10): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3515,14): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3528,20): error TS2300: Duplicate identifier 'write'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3569,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3569,16): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3623,21): error TS2339: Property 'cancel' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3629,14): error TS2339: Property 'cancel' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3634,10): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3635,10): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3637,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3637,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3638,17): error TS2339: Property 'cancel' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3675,40): error TS2339: Property 'browser' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3689,40): error TS2339: Property 'browser' does not exist on type 'Terminal'.
@@ -11630,8 +11630,8 @@ node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3919,10): error TS2339: Property 'cancel' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3936,10): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3937,10): error TS2339: Property 'emit' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3939,5): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3946,13): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3939,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3946,26): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3953,15): error TS2339: Property 'visualBell' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3960,14): error TS2339: Property 'popOnBell' does not exist on type 'Terminal'.
node_modules/chrome-devtools-frontend/front_end/terminal/xterm.js/build/xterm.js(3964,15): error TS2339: Property 'debug' does not exist on type 'Terminal'.
@@ -13401,7 +13401,7 @@ node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1561,11): error TS
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1562,17): error TS2339: Property 'value' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1570,25): error TS2339: Property 'value' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1574,11): error TS2339: Property 'value' does not exist on type 'Element'.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1633,64): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1633,77): error TS2554: Expected 0 arguments, but got 1.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1646,40): error TS2339: Property '_textWidthCache' does not exist on type '(context: CanvasRenderingContext2D, text: string) => number'.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1649,25): error TS2339: Property '_textWidthCache' does not exist on type '(context: CanvasRenderingContext2D, text: string) => number'.
node_modules/chrome-devtools-frontend/front_end/ui/UIUtils.js(1715,20): error TS2339: Property 'type' does not exist on type 'Element'.
+2 -2
View File
@@ -5,8 +5,8 @@ node_modules/debug/dist/debug.js(3,165): error TS2539: Cannot assign to '_typeof
node_modules/debug/dist/debug.js(8,21): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(8,46): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(9,5): error TS2304: Cannot find name 'define'.
node_modules/debug/dist/debug.js(33,33): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(34,27): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(33,38): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(34,32): error TS2554: Expected 1 arguments, but got 2.
node_modules/debug/dist/debug.js(36,21): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/debug/dist/debug.js(89,38): error TS2339: Property 'length' does not exist on type 'string | number'.
Property 'length' does not exist on type 'number'.

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