Merge branch 'master' into mergeMaster7-12

This commit is contained in:
Mohamed Hegazy
2018-07-12 11:31:45 -07:00
93 changed files with 2071 additions and 1243 deletions
+2 -2
View File
@@ -225,11 +225,11 @@ namespace ts {
node.symbol = symbol;
symbol.declarations = append(symbol.declarations, node);
if (symbolFlags & SymbolFlags.HasExports && !symbol.exports) {
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.Module | SymbolFlags.Variable) && !symbol.exports) {
symbol.exports = createSymbolTable();
}
if (symbolFlags & SymbolFlags.HasMembers && !symbol.members) {
if (symbolFlags & (SymbolFlags.Class | SymbolFlags.Interface | SymbolFlags.TypeLiteral | SymbolFlags.ObjectLiteral) && !symbol.members) {
symbol.members = createSymbolTable();
}
+181 -78
View File
@@ -2417,12 +2417,12 @@ namespace ts {
// The ES6 spec permits export * declarations in a module to circularly reference the module itself. For example,
// module 'a' can 'export * from "b"' and 'b' can 'export * from "a"' without error.
function visit(symbol: Symbol | undefined): SymbolTable | undefined {
if (!(symbol && symbol.flags & SymbolFlags.HasExports && pushIfUnique(visitedSymbols, symbol))) {
if (!(symbol && symbol.exports && pushIfUnique(visitedSymbols, symbol))) {
return;
}
const symbols = cloneMap(symbol.exports!);
const symbols = cloneMap(symbol.exports);
// All export * declarations are collected in an __export symbol by the binder
const exportStars = symbol.exports!.get(InternalSymbolName.ExportStar);
const exportStars = symbol.exports.get(InternalSymbolName.ExportStar);
if (exportStars) {
const nestedSymbols = createSymbolTable();
const lookupTable = createMap<ExportCollisionTracker>() as ExportCollisionTrackerTable;
@@ -7566,12 +7566,21 @@ namespace ts {
const setter = getDeclarationOfKind<AccessorDeclaration>(getSymbolOfNode(declaration), SyntaxKind.SetAccessor);
return getAnnotatedAccessorType(setter);
}
const typeFromTag = getReturnTypeOfTypeTag(declaration);
if (typeFromTag) {
return typeFromTag;
}
if (nodeIsMissing((<FunctionLikeDeclaration>declaration).body)) {
return anyType;
}
}
function getReturnTypeOfTypeTag(node: SignatureDeclaration | JSDocSignature) {
const typeTag = isInJavaScriptFile(node) ? getJSDocTypeTag(node) : undefined;
const signatures = typeTag && typeTag.typeExpression && getSignaturesOfType(getTypeFromTypeNode(typeTag.typeExpression), SignatureKind.Call);
return signatures && signatures.length === 1 ? getReturnTypeOfSignature(signatures[0]) : undefined;
}
function containsArgumentsReference(declaration: SignatureDeclaration): boolean {
const links = getNodeLinks(declaration);
if (links.containsArgumentsReference === undefined) {
@@ -7702,9 +7711,13 @@ namespace ts {
return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, TypeSystemPropertyName.ResolvedReturnType) >= 0;
}
function getRestTypeOfSignature(signature: Signature) {
function getRestTypeOfSignature(signature: Signature): Type {
return tryGetRestTypeOfSignature(signature) || anyType;
}
function tryGetRestTypeOfSignature(signature: Signature): Type | undefined {
const type = getTypeOfRestParameter(signature);
return type && getIndexTypeOfType(type, IndexKind.Number) || anyType;
return type && getIndexTypeOfType(type, IndexKind.Number);
}
function getSignatureInstantiation(signature: Signature, typeArguments: Type[] | undefined, isJavascript: boolean): Signature {
@@ -9377,11 +9390,9 @@ namespace ts {
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
const argumentType = getTypeFromTypeNode(node.argument);
const targetMeaning = node.isTypeOf ? SymbolFlags.Value : SymbolFlags.Type;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
const moduleName = (argumentType as StringLiteralType).value;
const innerModuleSymbol = resolveExternalModule(node, moduleName, Diagnostics.Cannot_find_module_0, node, /*isForAugmentation*/ false);
const innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
@@ -9413,7 +9424,7 @@ namespace ts {
? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here
: Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
error(node, errorMessage, moduleName);
error(node, errorMessage, node.argument.literal.text);
links.resolvedSymbol = unknownSymbol;
links.resolvedType = errorType;
@@ -17404,7 +17415,7 @@ namespace ts {
*/
function isKnownProperty(targetType: Type, name: __String, isComparingJsxAttributes: boolean): boolean {
if (targetType.flags & TypeFlags.Object) {
const resolved = resolveStructuredTypeMembers(<ObjectType>targetType);
const resolved = resolveStructuredTypeMembers(targetType as ObjectType);
if (resolved.stringIndexInfo ||
resolved.numberIndexInfo && isNumericLiteralName(name) ||
getPropertyOfObjectType(targetType, name) ||
@@ -17414,12 +17425,16 @@ namespace ts {
}
}
else if (targetType.flags & TypeFlags.UnionOrIntersection) {
for (const t of (<UnionOrIntersectionType>targetType).types) {
for (const t of (targetType as UnionOrIntersectionType).types) {
if (isKnownProperty(t, name, isComparingJsxAttributes)) {
return true;
}
}
}
else if (targetType.flags & TypeFlags.Conditional) {
return isKnownProperty((targetType as ConditionalType).root.trueType, name, isComparingJsxAttributes) ||
isKnownProperty((targetType as ConditionalType).root.falseType, name, isComparingJsxAttributes);
}
return false;
}
@@ -18828,7 +18843,7 @@ namespace ts {
node.kind === SyntaxKind.SetAccessor) {
// The `descriptor` for a method decorator will be a `TypedPropertyDescriptor<T>`
// for the type of the member.
const propertyType = getTypeOfNode(node)!; // TODO: GH#18217
const propertyType = getTypeOfNode(node);
return createTypedPropertyDescriptorType(propertyType);
}
@@ -19046,61 +19061,46 @@ namespace ts {
else if (args) {
let min = Number.POSITIVE_INFINITY;
let max = Number.NEGATIVE_INFINITY;
let belowArgCount = Number.NEGATIVE_INFINITY;
let aboveArgCount = Number.POSITIVE_INFINITY;
let argCount = args.length;
for (const sig of signatures) {
min = Math.min(min, getMinArgumentCount(sig));
max = Math.max(max, getParameterCount(sig));
const minCount = getMinArgumentCount(sig);
const maxCount = getParameterCount(sig);
if (minCount < argCount && minCount > belowArgCount) belowArgCount = minCount;
if (argCount < maxCount && maxCount < aboveArgCount) aboveArgCount = maxCount;
min = Math.min(min, minCount);
max = Math.max(max, maxCount);
}
const hasRestParameter = some(signatures, hasEffectiveRestParameter);
const hasSpreadArgument = getSpreadArgumentIndex(args) > -1;
const paramCount = hasRestParameter ? min :
const paramRange = hasRestParameter ? min :
min < max ? min + "-" + max :
min;
let argCount = args.length;
const hasSpreadArgument = getSpreadArgumentIndex(args) > -1;
if (argCount <= max && hasSpreadArgument) {
argCount--;
}
const error = hasRestParameter && hasSpreadArgument ? Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 :
hasSpreadArgument ? Diagnostics.Expected_0_arguments_but_got_1_or_more :
Diagnostics.Expected_0_arguments_but_got_1;
diagnostics.add(createDiagnosticForNode(node, error, paramCount, argCount));
if (hasRestParameter || hasSpreadArgument) {
const error = hasRestParameter && hasSpreadArgument ? Diagnostics.Expected_at_least_0_arguments_but_got_1_or_more :
hasRestParameter ? Diagnostics.Expected_at_least_0_arguments_but_got_1 :
Diagnostics.Expected_0_arguments_but_got_1_or_more;
diagnostics.add(createDiagnosticForNode(node, error, paramRange, argCount));
}
else if (min < argCount && argCount < max) {
diagnostics.add(createDiagnosticForNode(node, Diagnostics.No_overload_expects_0_arguments_but_overloads_do_exist_that_expect_either_1_or_2_arguments, argCount, belowArgCount, aboveArgCount));
}
else {
diagnostics.add(createDiagnosticForNode(node, Diagnostics.Expected_0_arguments_but_got_1, paramRange, argCount));
}
}
else if (fallbackError) {
diagnostics.add(createDiagnosticForNode(node, fallbackError));
}
// No signature was applicable. We have already reported the errors for the invalid signature.
// If this is a type resolution session, e.g. Language Service, try to get better information than anySignature.
// Pick the longest signature. This way we can get a contextual type for cases like:
// declare function f(a: { xa: number; xb: number; }, b: number);
// f({ |
// Also, use explicitly-supplied type arguments if they are provided, so we can get a contextual signature in cases like:
// declare function f<T>(k: keyof T);
// f<Foo>("
if (!produceDiagnostics) {
Debug.assert(candidates.length > 0); // Else would have exited above.
const bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args!.length : apparentArgumentCount);
const candidate = candidates[bestIndex];
const { typeParameters } = candidate;
if (typeParameters && callLikeExpressionMayHaveTypeArguments(node) && node.typeArguments) {
const typeArguments = node.typeArguments.map(getTypeOfNode) as Type[]; // TODO: GH#18217
while (typeArguments.length > typeParameters.length) {
typeArguments.pop();
}
while (typeArguments.length < typeParameters.length) {
typeArguments.push(getDefaultTypeArgumentType(isInJavaScriptFile(node)));
}
const instantiated = createSignatureInstantiation(candidate, typeArguments);
candidates[bestIndex] = instantiated;
return instantiated;
}
return candidate;
}
return resolveErrorCall(node);
return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
candidateForArgumentError = undefined;
@@ -19171,6 +19171,97 @@ namespace ts {
}
}
// No signature was applicable. We have already reported the errors for the invalid signature.
// If this is a type resolution session, e.g. Language Service, try to get better information than anySignature.
function getCandidateForOverloadFailure(
node: CallLikeExpression,
candidates: Signature[],
args: ReadonlyArray<Expression>,
hasCandidatesOutArray: boolean,
): Signature {
Debug.assert(candidates.length > 0); // Else should not have called this.
// Normally we will combine overloads. Skip this if they have type parameters since that's hard to combine.
// Don't do this if there is a `candidatesOutArray`,
// because then we want the chosen best candidate to be one of the overloads, not a combination.
return hasCandidatesOutArray || candidates.length === 1 || candidates.some(c => !!c.typeParameters)
? pickLongestCandidateSignature(node, candidates, args)
: createUnionOfSignaturesForOverloadFailure(candidates);
}
function createUnionOfSignaturesForOverloadFailure(candidates: ReadonlyArray<Signature>): Signature {
const thisParameters = mapDefined(candidates, c => c.thisParameter);
let thisParameter: Symbol | undefined;
if (thisParameters.length) {
thisParameter = createCombinedSymbolFromTypes(thisParameters, thisParameters.map(getTypeOfParameter));
}
const { min: minArgumentCount, max: maxNonRestParam } = minAndMax(candidates, getNumNonRestParameters);
const parameters: Symbol[] = [];
for (let i = 0; i < maxNonRestParam; i++) {
const symbols = mapDefined(candidates, ({ parameters, hasRestParameter }) => hasRestParameter ?
i < parameters.length - 1 ? parameters[i] : last(parameters) :
i < parameters.length ? parameters[i] : undefined);
Debug.assert(symbols.length !== 0);
parameters.push(createCombinedSymbolFromTypes(symbols, mapDefined(candidates, candidate => tryGetTypeAtPosition(candidate, i))));
}
const restParameterSymbols = mapDefined(candidates, c => c.hasRestParameter ? last(c.parameters) : undefined);
const hasRestParameter = restParameterSymbols.length !== 0;
if (hasRestParameter) {
const type = createArrayType(getUnionType(mapDefined(candidates, tryGetRestTypeOfSignature), UnionReduction.Subtype));
parameters.push(createCombinedSymbolForOverloadFailure(restParameterSymbols, type));
}
return createSignature(
candidates[0].declaration,
/*typeParameters*/ undefined, // Before calling this we tested for `!candidates.some(c => !!c.typeParameters)`.
thisParameter,
parameters,
/*resolvedReturnType*/ getIntersectionType(candidates.map(getReturnTypeOfSignature)),
/*typePredicate*/ undefined,
minArgumentCount,
hasRestParameter,
/*hasLiteralTypes*/ candidates.some(c => c.hasLiteralTypes));
}
function getNumNonRestParameters(signature: Signature): number {
const numParams = signature.parameters.length;
return signature.hasRestParameter ? numParams - 1 : numParams;
}
function createCombinedSymbolFromTypes(sources: ReadonlyArray<Symbol>, types: Type[]): Symbol {
return createCombinedSymbolForOverloadFailure(sources, getUnionType(types, UnionReduction.Subtype));
}
function createCombinedSymbolForOverloadFailure(sources: ReadonlyArray<Symbol>, type: Type): Symbol {
// This function is currently only used for erroneous overloads, so it's good enough to just use the first source.
return createSymbolWithType(first(sources), type);
}
function pickLongestCandidateSignature(node: CallLikeExpression, candidates: Signature[], args: ReadonlyArray<Expression>): Signature {
// Pick the longest signature. This way we can get a contextual type for cases like:
// declare function f(a: { xa: number; xb: number; }, b: number);
// f({ |
// Also, use explicitly-supplied type arguments if they are provided, so we can get a contextual signature in cases like:
// declare function f<T>(k: keyof T);
// f<Foo>("
const bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args.length : apparentArgumentCount);
const candidate = candidates[bestIndex];
const { typeParameters } = candidate;
if (!typeParameters) {
return candidate;
}
const typeArgumentNodes: ReadonlyArray<TypeNode> = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments || emptyArray : emptyArray;
const typeArguments = typeArgumentNodes.map(n => getTypeOfNode(n) || anyType);
while (typeArguments.length > typeParameters.length) {
typeArguments.pop();
}
while (typeArguments.length < typeParameters.length) {
typeArguments.push(getConstraintFromTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isInJavaScriptFile(node)));
}
const instantiated = createSignatureInstantiation(candidate, typeArguments);
candidates[bestIndex] = instantiated;
return instantiated;
}
function getLongestCandidateIndex(candidates: Signature[], argsCount: number): number {
let maxParamsIndex = -1;
let maxParams = -1;
@@ -19955,6 +20046,10 @@ namespace ts {
}
function getTypeAtPosition(signature: Signature, pos: number): Type {
return tryGetTypeAtPosition(signature, pos) || anyType;
}
function tryGetTypeAtPosition(signature: Signature, pos: number): Type | undefined {
const paramCount = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
if (pos < paramCount) {
return getTypeOfParameter(signature.parameters[pos]);
@@ -19970,9 +20065,9 @@ namespace ts {
return tupleRestType;
}
}
return getIndexTypeOfType(restType, IndexKind.Number) || anyType;
return getIndexTypeOfType(restType, IndexKind.Number);
}
return anyType;
return undefined;
}
function getRestTypeAtPosition(source: Signature, pos: number): Type {
@@ -20453,15 +20548,20 @@ namespace ts {
return type;
}
function getReturnOrPromisedType(node: FunctionLikeDeclaration | MethodSignature, functionFlags: FunctionFlags) {
const returnTypeNode = getEffectiveReturnTypeNode(node);
return returnTypeNode &&
((functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async ?
checkAsyncFunctionReturnType(node, returnTypeNode) : // Async function
getTypeFromTypeNode(returnTypeNode)) || // AsyncGenerator function, Generator function, or normal function
getReturnTypeOfTypeTag(node); // type from JSDoc @type tag
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node: ArrowFunction | FunctionExpression | MethodDeclaration) {
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
const functionFlags = getFunctionFlags(node);
const returnTypeNode = getEffectiveReturnTypeNode(node);
const returnOrPromisedType = returnTypeNode &&
((functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async ?
checkAsyncFunctionReturnType(node) : // Async function
getTypeFromTypeNode(returnTypeNode)); // AsyncGenerator function, Generator function, or normal function
const returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & FunctionFlags.Generator) === 0) { // Async function or normal function
// return is not necessary in the body of generators
@@ -20469,7 +20569,7 @@ namespace ts {
}
if (node.body) {
if (!returnTypeNode) {
if (!getEffectiveReturnTypeNode(node)) {
// There are some checks that are only performed in getReturnTypeFromBody, that may produce errors
// we need. An example is the noImplicitAny errors resulting from widening the return expression
// of a function. Because checking of function expression bodies is deferred, there was never an
@@ -21779,7 +21879,7 @@ namespace ts {
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])!, // TODO: GH#18217
getTypeOfNode(parent.parameters[typePredicate.parameterIndex]),
node.type,
/*headMessage*/ undefined,
leadingError);
@@ -21921,7 +22021,7 @@ namespace ts {
}
}
else if ((functionFlags & FunctionFlags.AsyncGenerator) === FunctionFlags.Async) {
checkAsyncFunctionReturnType(<FunctionLikeDeclaration>node);
checkAsyncFunctionReturnType(<FunctionLikeDeclaration>node, returnTypeNode);
}
}
if (node.kind !== SyntaxKind.IndexSignature && node.kind !== SyntaxKind.JSDocFunctionType) {
@@ -22981,7 +23081,7 @@ namespace ts {
*
* @param node The signature to check
*/
function checkAsyncFunctionReturnType(node: FunctionLikeDeclaration | MethodSignature): Type {
function checkAsyncFunctionReturnType(node: FunctionLikeDeclaration | MethodSignature, returnTypeNode: TypeNode): Type {
// As part of our emit for an async function, we will need to emit the entity name of
// the return type annotation as an expression. To meet the necessary runtime semantics
// for __awaiter, we must also check that the type of the declaration (e.g. the static
@@ -23006,7 +23106,6 @@ namespace ts {
// then<U>(...): Promise<U>;
// }
//
const returnTypeNode = getEffectiveReturnTypeNode(node)!; // TODO: GH#18217
const returnType = getTypeFromTypeNode(returnTypeNode);
if (languageVersion >= ScriptTarget.ES2015) {
@@ -23111,7 +23210,7 @@ namespace ts {
case SyntaxKind.MethodDeclaration:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
const methodType = getTypeOfNode(node.parent)!; // TODO: GH#18217
const methodType = getTypeOfNode(node.parent);
const descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
break;
@@ -23416,15 +23515,12 @@ namespace ts {
const body = node.kind === SyntaxKind.MethodSignature ? undefined : node.body;
checkSourceElement(body);
const returnTypeNode = getEffectiveReturnTypeNode(node);
if ((functionFlags & FunctionFlags.Generator) === 0) { // Async function or normal function
const returnOrPromisedType = returnTypeNode && (functionFlags & FunctionFlags.Async
? checkAsyncFunctionReturnType(node) // Async function
: getTypeFromTypeNode(returnTypeNode)); // normal function
const returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
}
if (produceDiagnostics && !returnTypeNode) {
if (produceDiagnostics && !getEffectiveReturnTypeNode(node)) {
// Report an implicit any error if there is no body, no explicit return type, and node is not a private method
// in an ambient context
if (noImplicitAny && nodeIsMissing(body) && !isPrivateWithinAmbient(node)) {
@@ -23437,6 +23533,13 @@ namespace ts {
// yielded values. The only way to trigger these errors is to try checking its return type.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
// A js function declaration can have a @type tag instead of a return type node, but that type must have a call signature
if (isInJavaScriptFile(node)) {
const typeTag = getJSDocTypeTag(node);
if (typeTag && typeTag.typeExpression && !getSignaturesOfType(getTypeFromTypeNode(typeTag.typeExpression), SignatureKind.Call).length) {
error(typeTag, Diagnostics.The_type_of_a_function_declaration_must_be_callable);
}
}
}
}
@@ -24699,7 +24802,7 @@ namespace ts {
error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
}
else if (getEffectiveReturnTypeNode(func) || isGetAccessorWithAnnotatedSetAccessor(func)) {
else if (getEffectiveReturnTypeNode(func) || isGetAccessorWithAnnotatedSetAccessor(func) || getReturnTypeOfTypeTag(func)) {
if (functionFlags & FunctionFlags.Async) { // Async function
const promisedType = getPromisedTypeOfPromise(returnType);
const awaitedType = checkAwaitedType(exprType, node, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
@@ -27050,7 +27153,7 @@ namespace ts {
resolveEntityName(node.propertyName || node.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias);
}
function getTypeOfNode(node: Node): Type | undefined {
function getTypeOfNode(node: Node): Type {
if (node.flags & NodeFlags.InWithStatement) {
// We cannot answer semantic questions within a with block, do not proceed any further
return errorType;
@@ -27089,7 +27192,7 @@ namespace ts {
if (isTypeDeclarationName(node)) {
const symbol = getSymbolAtLocation(node);
return symbol && getDeclaredTypeOfSymbol(symbol);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
}
if (isDeclaration(node)) {
@@ -27100,11 +27203,11 @@ namespace ts {
if (isDeclarationNameOrImportPropertyName(node)) {
const symbol = getSymbolAtLocation(node);
return symbol && getTypeOfSymbol(symbol);
return symbol ? getTypeOfSymbol(symbol) : errorType;
}
if (isBindingPattern(node)) {
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true);
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true) || errorType;
}
if (isInRightSideOfImportOrExportAssignment(<Identifier>node)) {
+3
View File
@@ -1866,6 +1866,9 @@ namespace ts {
if (candidateName !== undefined && Math.abs(candidateName.length - nameLowerCase.length) <= maximumLengthDifference) {
const candidateNameLowerCase = candidateName.toLowerCase();
if (candidateNameLowerCase === nameLowerCase) {
if (candidateName === name) {
continue;
}
return candidate;
}
if (justCheckExactMatches) {
+8
View File
@@ -2056,6 +2056,10 @@
"category": "Error",
"code": 2574
},
"No overload expects {0} arguments, but overloads do exist that expect either {1} or {2} arguments.": {
"category": "Error",
"code": 2575
},
"JSX element attributes type '{0}' may not be a union type.": {
"category": "Error",
"code": 2600
@@ -4017,6 +4021,10 @@
"category": "Error",
"code": 8029
},
"The type of a function declaration must be callable.": {
"category": "Error",
"code": 8030
},
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause.": {
"category": "Error",
"code": 9002
+2 -2
View File
@@ -171,8 +171,8 @@ namespace ts {
}
const t = getTypeOfSymbol(symbol);
visitType(t); // Should handle members on classes and such
if (symbol.flags & SymbolFlags.HasExports) {
symbol.exports!.forEach(visitSymbol);
if (symbol.exports) {
symbol.exports.forEach(visitSymbol);
}
forEach(symbol.declarations, d => {
// Type queries are too far resolved when we just visit the symbol's type
+5 -5
View File
@@ -529,7 +529,7 @@ namespace ts {
createVariableStatement(/*modifiers*/ undefined,
createVariableDeclarationList(taggedTemplateStringDeclarations)));
}
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
exitSubtree(ancestorFacts, HierarchyFacts.None, HierarchyFacts.None);
return updateSourceFileNode(
node,
@@ -837,7 +837,7 @@ namespace ts {
setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps);
statements.push(statement);
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const block = createBlock(setTextRange(createNodeArray(statements), /*location*/ node.members), /*multiLine*/ true);
setEmitFlags(block, EmitFlags.NoComments);
@@ -980,7 +980,7 @@ namespace ts {
);
}
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
if (constructor) {
prependCaptureNewTargetIfNeeded(statements, constructor, /*copyOnWrite*/ false);
@@ -1892,7 +1892,7 @@ namespace ts {
}
const lexicalEnvironment = context.endLexicalEnvironment();
prependStatements(statements, lexicalEnvironment);
addStatementsAfterPrologue(statements, lexicalEnvironment);
prependCaptureNewTargetIfNeeded(statements, node, /*copyOnWrite*/ false);
// If we added any final generated statements, this must be a multi-line block
@@ -2707,7 +2707,7 @@ namespace ts {
if (loopOutParameters.length) {
copyOutParameters(loopOutParameters, CopyDirection.ToOutParameter, statements);
}
prependStatements(statements, lexicalEnvironment);
addStatementsAfterPrologue(statements, lexicalEnvironment);
loopBody = createBlock(statements, /*multiline*/ true);
}
+1 -1
View File
@@ -413,7 +413,7 @@ namespace ts {
)
);
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const block = createBlock(statements, /*multiLine*/ true);
setTextRange(block, node.body);
+2 -2
View File
@@ -675,7 +675,7 @@ namespace ts {
)
);
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const block = updateBlock(node.body!, statements);
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
@@ -707,7 +707,7 @@ namespace ts {
const leadingStatements = endLexicalEnvironment();
if (statementOffset > 0 || some(statements) || some(leadingStatements)) {
const block = convertToFunctionBody(body, /*multiLine*/ true);
prependStatements(statements, leadingStatements);
addStatementsAfterPrologue(statements, leadingStatements);
addRange(statements, block.statements.slice(statementOffset));
return updateBlock(block, setTextRange(createNodeArray(statements), block.statements));
}
+1 -1
View File
@@ -587,7 +587,7 @@ namespace ts {
transformAndEmitStatements(body.statements, statementOffset);
const buildResult = build();
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
statements.push(createReturn(buildResult));
// Restore previous generator state
+2 -2
View File
@@ -97,7 +97,7 @@ namespace ts {
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement));
addRange(statements, visitNodes(node.statements, sourceElementVisitor, isStatement, statementOffset));
addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const updated = updateSourceFileNode(node, setTextRange(createNodeArray(statements), node.statements));
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
@@ -426,7 +426,7 @@ namespace ts {
// End the lexical environment for the module body
// and merge any new lexical declarations.
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const body = createBlock(statements, /*multiLine*/ true);
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
+1 -1
View File
@@ -257,7 +257,7 @@ namespace ts {
// We emit hoisted variables early to align roughly with our previous emit output.
// Two key differences in this approach are:
// - Temporary variables will appear at the top rather than at the bottom of the file
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
const exportStarFunction = addExportStarIfNeeded(statements)!; // TODO: GH#18217
const moduleObject = createObjectLiteral([
+3 -3
View File
@@ -682,7 +682,7 @@ namespace ts {
setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps);
statements.push(statement);
prependStatements(statements, context.endLexicalEnvironment());
addStatementsAfterPrologue(statements, context.endLexicalEnvironment());
const iife = createImmediatelyInvokedArrowFunction(statements);
setEmitFlags(iife, EmitFlags.TypeScriptClassWrapper);
@@ -2711,7 +2711,7 @@ namespace ts {
const statements: Statement[] = [];
startLexicalEnvironment();
const members = map(node.members, transformEnumMember);
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
addRange(statements, members);
currentNamespaceContainerName = savedCurrentNamespaceLocalName;
@@ -3026,7 +3026,7 @@ namespace ts {
statementsLocation = moveRangePos(moduleBlock.statements, -1);
}
prependStatements(statements, endLexicalEnvironment());
addStatementsAfterPrologue(statements, endLexicalEnvironment());
currentNamespaceContainerName = savedCurrentNamespaceContainerName;
currentNamespace = savedCurrentNamespace;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
+1 -4
View File
@@ -2936,7 +2936,7 @@ namespace ts {
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
getTypeAtLocation(node: Node): Type | undefined;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
@@ -3439,9 +3439,6 @@ namespace ts {
ExportHasLocal = Function | Class | Enum | ValueModule,
HasExports = Class | Enum | Module | Variable,
HasMembers = Class | Interface | TypeLiteral | ObjectLiteral,
BlockScoped = BlockScopedVariable | Class | Enum,
PropertyOrAccessor = Property | Accessor,
+26 -15
View File
@@ -401,21 +401,18 @@ namespace ts {
}
/**
* Appends a range of value to begin of an array, returning the array.
*
* @param to The array to which `value` is to be appended. If `to` is `undefined`, a new array
* is created if `value` was appended.
* @param from The values to append to the array. If `from` is `undefined`, nothing is
* appended. If an element of `from` is `undefined`, that element is not appended.
* Prepends statements to an array while taking care of prologue directives.
*/
export function prependStatements<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] | undefined {
export function addStatementsAfterPrologue<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] {
if (from === undefined || from.length === 0) return to;
if (to === undefined) return from.slice();
const prologue = to.length && isPrologueDirective(to[0]) && to.shift();
to.unshift(...from);
if (prologue) {
to.unshift(prologue);
let statementIndex = 0;
// skip all prologue directives to insert at the correct position
for (; statementIndex < to.length; ++statementIndex) {
if (!isPrologueDirective(to[statementIndex])) {
break;
}
}
to.splice(statementIndex, 0, ...from);
return to;
}
@@ -912,9 +909,7 @@ namespace ts {
}
export function isLiteralImportTypeNode(n: Node): n is LiteralImportTypeNode {
return n.kind === SyntaxKind.ImportType &&
(n as ImportTypeNode).argument.kind === SyntaxKind.LiteralType &&
isStringLiteral(((n as ImportTypeNode).argument as LiteralTypeNode).literal);
return isImportTypeNode(n) && isLiteralTypeNode(n.argument) && isStringLiteral(n.argument.literal);
}
export function isPrologueDirective(node: Node): node is PrologueDirective {
@@ -8090,4 +8085,20 @@ namespace ts {
Debug.assert(index !== -1);
return arr.slice(index);
}
export function minAndMax<T>(arr: ReadonlyArray<T>, getValue: (value: T) => number): { readonly min: number, readonly max: number } {
Debug.assert(arr.length !== 0);
let min = getValue(arr[0]);
let max = min;
for (let i = 1; i < arr.length; i++) {
const value = getValue(arr[i]);
if (value < min) {
min = value;
}
else if (value > max) {
max = value;
}
}
return { min, max };
}
}
+2 -2
View File
@@ -1476,8 +1476,8 @@ namespace ts {
}
return isNodeArray(statements)
? setTextRange(createNodeArray(prependStatements(statements.slice(), declarations)), statements)
: prependStatements(statements, declarations);
? setTextRange(createNodeArray(addStatementsAfterPrologue(statements.slice(), declarations)), statements)
: addStatementsAfterPrologue(statements, declarations);
}
/**
+1 -1
View File
@@ -4767,7 +4767,7 @@ namespace FourSlashInterface {
}
export interface VerifyCompletionsOptions {
readonly marker?: ArrayOrSingle<string>;
readonly marker?: ArrayOrSingle<string | FourSlash.Marker>;
readonly isNewIdentifierLocation?: boolean;
readonly exact?: ArrayOrSingle<ExpectedCompletionEntry>;
readonly includes?: ArrayOrSingle<ExpectedCompletionEntry>;
@@ -124,7 +124,7 @@ namespace ts.codefix {
const { parent } = token;
if (!isPropertyAccessExpression(parent)) return undefined;
const leftExpressionType = skipConstraint(checker.getTypeAtLocation(parent.expression)!);
const leftExpressionType = skipConstraint(checker.getTypeAtLocation(parent.expression));
const { symbol } = leftExpressionType;
if (!symbol || !symbol.declarations) return undefined;
@@ -183,7 +183,7 @@ namespace ts.codefix {
if (token.parent.parent.kind === SyntaxKind.BinaryExpression) {
const binaryExpression = token.parent.parent as BinaryExpression;
const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)!)); // TODO: GH#18217
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
typeNode = checker.typeToTypeNode(widenedType, classDeclaration);
}
return typeNode || createKeywordTypeNode(SyntaxKind.AnyKeyword);
@@ -34,7 +34,7 @@ namespace ts.codefix {
function addMissingMembers(classDeclaration: ClassLikeDeclaration, sourceFile: SourceFile, checker: TypeChecker, changeTracker: textChanges.ChangeTracker, preferences: UserPreferences): void {
const extendsNode = getEffectiveBaseTypeNode(classDeclaration)!;
const instantiatedExtendsType = checker.getTypeAtLocation(extendsNode)!;
const instantiatedExtendsType = checker.getTypeAtLocation(extendsNode);
// Note that this is ultimately derived from a map indexed by symbol names,
// so duplicates cannot occur.
@@ -51,7 +51,7 @@ namespace ts.codefix {
const implementedTypeSymbols = checker.getPropertiesOfType(implementedType);
const nonPrivateAndNotExistedInHeritageClauseMembers = implementedTypeSymbols.filter(and(symbolPointsToNonPrivateMember, symbol => !maybeHeritageClauseSymbol.has(symbol.escapedName)));
const classType = checker.getTypeAtLocation(classDeclaration)!;
const classType = checker.getTypeAtLocation(classDeclaration);
if (!classType.getNumberIndexType()) {
createMissingIndexSignatureDeclaration(implementedType, IndexKind.Number);
@@ -77,7 +77,7 @@ namespace ts.codefix {
}
function getImportCodeFixesForExpression(context: CodeFixContext, expr: Node): CodeFixAction[] | undefined {
const type = context.program.getTypeChecker().getTypeAtLocation(expr)!; // TODO: GH#18217
const type = context.program.getTypeChecker().getTypeAtLocation(expr);
if (!(type.symbol && (type.symbol as TransientSymbol).originatingImport)) {
return [];
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace ts.codefix {
let suggestion: string | undefined;
if (isPropertyAccessExpression(node.parent) && node.parent.name === node) {
Debug.assert(node.kind === SyntaxKind.Identifier);
const containingType = checker.getTypeAtLocation(node.parent.expression)!;
const containingType = checker.getTypeAtLocation(node.parent.expression);
suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType);
}
else if (isImportSpecifier(node.parent) && node.parent.name === node) {
+4 -4
View File
@@ -401,7 +401,7 @@ namespace ts.codefix {
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanEqualsToken:
const operandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left)!;
const operandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (operandType.flags & TypeFlags.EnumLike) {
addCandidateType(usageContext, operandType);
}
@@ -412,7 +412,7 @@ namespace ts.codefix {
case SyntaxKind.PlusEqualsToken:
case SyntaxKind.PlusToken:
const otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left)!;
const otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (otherOperandType.flags & TypeFlags.EnumLike) {
addCandidateType(usageContext, otherOperandType);
}
@@ -472,7 +472,7 @@ namespace ts.codefix {
if (parent.arguments) {
for (const argument of parent.arguments) {
callContext.argumentTypes.push(checker.getTypeAtLocation(argument)!);
callContext.argumentTypes.push(checker.getTypeAtLocation(argument));
}
}
@@ -501,7 +501,7 @@ namespace ts.codefix {
return;
}
else {
const indexType = checker.getTypeAtLocation(parent)!;
const indexType = checker.getTypeAtLocation(parent);
const indexUsageContext = {};
inferTypeFromContext(parent, checker, indexUsageContext);
if (indexType.flags & TypeFlags.NumberLike) {
+3 -3
View File
@@ -1060,7 +1060,7 @@ namespace ts.Completions {
const isImportType = isLiteralImportTypeNode(node);
const isTypeLocation = insideJsDocTagTypeExpression || (isImportType && !(node as ImportTypeNode).isTypeOf) || isPartOfTypeNode(node.parent);
const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node);
const allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && isPossiblyTypeArgumentPosition(contextToken, sourceFile));
const allowTypeOrValue = isRhsOfImportDeclaration || (!isTypeLocation && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker));
if (isEntityName(node) || isImportType) {
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
@@ -1098,7 +1098,7 @@ namespace ts.Completions {
}
if (!isTypeLocation) {
addTypeProperties(typeChecker.getTypeAtLocation(node)!);
addTypeProperties(typeChecker.getTypeAtLocation(node));
}
}
@@ -1275,7 +1275,7 @@ namespace ts.Completions {
function filterGlobalCompletion(symbols: Symbol[]): void {
const isTypeOnlyCompletion = insideJsDocTagTypeExpression || !isContextTokenValueLocation(contextToken) && (isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken));
const allowTypes = isTypeOnlyCompletion || !isContextTokenValueLocation(contextToken) && isPossiblyTypeArgumentPosition(contextToken, sourceFile);
const allowTypes = isTypeOnlyCompletion || !isContextTokenValueLocation(contextToken) && isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker);
if (isTypeOnlyCompletion) keywordFilters = KeywordCompletionFilters.TypeKeywords;
filterMutate(symbols, symbol => {
+1 -1
View File
@@ -171,7 +171,7 @@ namespace ts.GoToDefinition {
// At 'x.foo', see if the type of 'x' has an index signature, and if so find its declarations.
function getDefinitionInfoForIndexSignatures(node: Node, checker: TypeChecker): DefinitionInfo[] | undefined {
if (!isPropertyAccessExpression(node.parent) || node.parent.name !== node) return;
const type = checker.getTypeAtLocation(node.parent.expression)!;
const type = checker.getTypeAtLocation(node.parent.expression);
return mapDefined(type.isUnionOrIntersection() ? type.types : [type], nonUnionType => {
const info = checker.getIndexInfoOfType(nonUnionType, IndexKind.String);
return info && info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration);
+3 -3
View File
@@ -866,7 +866,7 @@ namespace ts.refactor.extractSymbol {
// Being returned through an object literal will have widened the type.
const variableType: TypeNode | undefined = checker.typeToTypeNode(
checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)!), // TODO: GH#18217
checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)),
scope,
NodeBuilderFlags.NoTruncation);
@@ -1406,7 +1406,7 @@ namespace ts.refactor.extractSymbol {
const end = last(statements).end;
expressionDiagnostic = createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected);
}
else if (checker.getTypeAtLocation(expression)!.flags & (TypeFlags.Void | TypeFlags.Never)) { // TODO: GH#18217
else if (checker.getTypeAtLocation(expression).flags & (TypeFlags.Void | TypeFlags.Never)) {
expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType);
}
@@ -1555,7 +1555,7 @@ namespace ts.refactor.extractSymbol {
function collectUsages(node: Node, valueUsage = Usage.Read) {
if (inGenericContext) {
const type = checker.getTypeAtLocation(node)!; // TODO: GH#18217
const type = checker.getTypeAtLocation(node);
recordTypeParameterUsages(type);
}
+2 -4
View File
@@ -103,9 +103,7 @@ namespace ts.SignatureHelp {
if (onlyUseSyntacticOwners && !lessThanFollowsCalledExpression(startingToken, sourceFile, invocation.called)) {
return undefined;
}
const type = checker.getTypeAtLocation(invocation.called)!; // TODO: GH#18217
const signatures = isNewExpression(invocation.called.parent) ? type.getConstructSignatures() : type.getCallSignatures();
const candidates = signatures.filter(candidate => !!candidate.typeParameters && candidate.typeParameters.length >= argumentInfo.argumentCount);
const candidates = getPossibleGenericSignatures(invocation.called, argumentInfo.argumentCount, checker);
return candidates.length === 0 ? undefined : { candidates, resolvedSignature: first(candidates) };
}
else {
@@ -261,7 +259,7 @@ namespace ts.SignatureHelp {
};
}
else {
const typeArgInfo = isPossiblyTypeArgumentPosition(node, sourceFile);
const typeArgInfo = getPossibleTypeArgumentsInfo(node, sourceFile);
if (typeArgInfo) {
const { called, nTypeArguments } = typeArgInfo;
const invocation: Invocation = { kind: InvocationKind.TypeArgs, called };
+7 -7
View File
@@ -172,7 +172,7 @@ namespace ts.SymbolDisplay {
const useConstructSignatures = callExpressionLike.kind === SyntaxKind.NewExpression || (isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === SyntaxKind.SuperKeyword);
const allSignatures = useConstructSignatures ? type!.getConstructSignatures() : type!.getCallSignatures();
const allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!contains(allSignatures, signature.target) && !contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -184,7 +184,7 @@ namespace ts.SymbolDisplay {
if (useConstructSignatures && (symbolFlags & SymbolFlags.Class)) {
// Constructor
symbolKind = ScriptElementKind.constructorImplementationElement;
addPrefixForAnyFunctionOrVar(type!.symbol, symbolKind);
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else if (symbolFlags & SymbolFlags.Alias) {
symbolKind = ScriptElementKind.alias;
@@ -211,8 +211,8 @@ namespace ts.SymbolDisplay {
// If it is call or construct signature of lambda's write type name
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
displayParts.push(spacePart());
if (!(getObjectFlags(type!) & ObjectFlags.Anonymous) && type!.symbol) {
addRange(displayParts, symbolToDisplayParts(typeChecker, type!.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.AllowAnyNodeKind | SymbolFormatFlags.WriteTypeParametersOrArguments));
if (!(getObjectFlags(type) & ObjectFlags.Anonymous) && type.symbol) {
addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.AllowAnyNodeKind | SymbolFormatFlags.WriteTypeParametersOrArguments));
displayParts.push(lineBreakPart());
}
if (useConstructSignatures) {
@@ -238,7 +238,7 @@ namespace ts.SymbolDisplay {
declaration === (location.kind === SyntaxKind.ConstructorKeyword ? functionDeclaration.parent : functionDeclaration));
if (locationIsSymbolDeclaration) {
const allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type!.getNonNullableType().getConstructSignatures() : type!.getNonNullableType().getCallSignatures();
const allSignatures = functionDeclaration.kind === SyntaxKind.Constructor ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration)!; // TODO: GH#18217
}
@@ -249,12 +249,12 @@ namespace ts.SymbolDisplay {
if (functionDeclaration.kind === SyntaxKind.Constructor) {
// show (constructor) Type(...) signature
symbolKind = ScriptElementKind.constructorImplementationElement;
addPrefixForAnyFunctionOrVar(type!.symbol, symbolKind);
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
addPrefixForAnyFunctionOrVar(functionDeclaration.kind === SyntaxKind.CallSignature &&
!(type!.symbol.flags & SymbolFlags.TypeLiteral || type!.symbol.flags & SymbolFlags.ObjectLiteral) ? type!.symbol : symbol, symbolKind);
!(type.symbol.flags & SymbolFlags.TypeLiteral || type.symbol.flags & SymbolFlags.ObjectLiteral) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
+28 -11
View File
@@ -1053,18 +1053,29 @@ namespace ts.textChanges {
break;
case SyntaxKind.TypeParameter: {
const typeParameters = getEffectiveTypeParameterDeclarations(<DeclarationWithTypeParameters>node.parent);
if (typeParameters.length === 1) {
const { pos, end } = cast(typeParameters, isNodeArray);
const previousToken = getTokenAtPosition(sourceFile, pos - 1);
const nextToken = getTokenAtPosition(sourceFile, end);
Debug.assert(previousToken.kind === SyntaxKind.LessThanToken);
Debug.assert(nextToken.kind === SyntaxKind.GreaterThanToken);
const typeParam = node as TypeParameterDeclaration;
switch (typeParam.parent.kind) {
case SyntaxKind.JSDocTemplateTag:
changes.deleteRange(sourceFile, getRangeToDeleteJsDocTag(typeParam.parent, sourceFile));
break;
case SyntaxKind.InferType:
// TODO: GH#25594
break;
default: {
const typeParameters = getEffectiveTypeParameterDeclarations(typeParam.parent);
if (typeParameters.length === 1) {
const { pos, end } = cast(typeParameters, isNodeArray);
const previousToken = getTokenAtPosition(sourceFile, pos - 1);
const nextToken = getTokenAtPosition(sourceFile, end);
Debug.assert(previousToken.kind === SyntaxKind.LessThanToken);
Debug.assert(nextToken.kind === SyntaxKind.GreaterThanToken);
changes.deleteNodeRange(sourceFile, previousToken, nextToken);
}
else {
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
changes.deleteNodeRange(sourceFile, previousToken, nextToken);
}
else {
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
}
}
break;
}
@@ -1166,6 +1177,12 @@ namespace ts.textChanges {
Debug.assertNever(gp);
}
}
function getRangeToDeleteJsDocTag(node: JSDocTag, sourceFile: SourceFile): TextRange {
const { parent } = node;
const toDelete = parent.kind === SyntaxKind.JSDocComment && parent.comment === undefined && parent.tags!.length === 1 ? parent : node;
return createTextRangeFromNode(toDelete, sourceFile);
}
}
/** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */
+19 -1
View File
@@ -917,11 +917,25 @@ namespace ts {
}
}
export function isPossiblyTypeArgumentPosition(token: Node, sourceFile: SourceFile, checker: TypeChecker): boolean {
const info = getPossibleTypeArgumentsInfo(token, sourceFile);
return info !== undefined && (isPartOfTypeNode(info.called) ||
getPossibleGenericSignatures(info.called, info.nTypeArguments, checker).length !== 0 ||
isPossiblyTypeArgumentPosition(info.called, sourceFile, checker));
}
export function getPossibleGenericSignatures(called: Expression, typeArgumentCount: number, checker: TypeChecker): ReadonlyArray<Signature> {
const type = checker.getTypeAtLocation(called);
const signatures = isNewExpression(called.parent) ? type.getConstructSignatures() : type.getCallSignatures();
return signatures.filter(candidate => !!candidate.typeParameters && candidate.typeParameters.length >= typeArgumentCount);
}
export interface PossibleTypeArgumentInfo {
readonly called: Identifier;
readonly nTypeArguments: number;
}
export function isPossiblyTypeArgumentPosition(tokenIn: Node, sourceFile: SourceFile): PossibleTypeArgumentInfo | undefined {
// Get info for an expression like `f <` that may be the start of type arguments.
export function getPossibleTypeArgumentsInfo(tokenIn: Node, sourceFile: SourceFile): PossibleTypeArgumentInfo | undefined {
let token: Node | undefined = tokenIn;
// This function determines if the node could be type argument position
// Since during editing, when type argument list is not complete,
@@ -1146,6 +1160,10 @@ namespace ts {
return createTextSpanFromBounds(node.getStart(sourceFile), node.getEnd());
}
export function createTextRangeFromNode(node: Node, sourceFile: SourceFile): TextRange {
return createTextRange(node.getStart(sourceFile), node.end);
}
export function createTextSpanFromRange(range: TextRange): TextSpan {
return createTextSpanFromBounds(range.pos, range.end);
}
+1 -3
View File
@@ -1901,7 +1901,7 @@ declare namespace ts {
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
getTypeAtLocation(node: Node): Type | undefined;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
@@ -2075,8 +2075,6 @@ declare namespace ts {
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
HasExports = 1955,
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500
+1 -3
View File
@@ -1901,7 +1901,7 @@ declare namespace ts {
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
getTypeAtLocation(node: Node): Type | undefined;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
@@ -2075,8 +2075,6 @@ declare namespace ts {
AliasExcludes = 2097152,
ModuleMember = 2623475,
ExportHasLocal = 944,
HasExports = 1955,
HasMembers = 6240,
BlockScoped = 418,
PropertyOrAccessor = 98308,
ClassMember = 106500
+1 -1
View File
@@ -43,7 +43,7 @@ var outside = n => n + 1;
/** @type {Final<{ fantasy }, { heroes }>} */
var noreturn = (barts, tidus, noctis) => "cecil"
>noreturn : Final<{ fantasy: any; }, { heroes: any; }>
>(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil"
>(barts, tidus, noctis) => "cecil" : (barts: { fantasy: any; }, tidus: { heroes: any; }, noctis: { heroes: any; } & { fantasy: any; }) => "cecil" | "zidane"
>barts : { fantasy: any; }
>tidus : { heroes: any; }
>noctis : { heroes: any; } & { fantasy: any; }
@@ -11,7 +11,7 @@ var x = 1;
/** @type {NS.Nested.Inner} */
function f(space, peace) {
>f : (space: any, peace: any) => string
>f : (space: any, peace: any) => string | number
>space : any
>peace : any
@@ -61,7 +61,7 @@ y(1);
/** @type {function (number)} */
const x1 = (a) => a + 1;
>x1 : (arg0: number) => any
>(a) => a + 1 : (a: number) => number
>(a) => a + 1 : (a: number) => any
>a : number
>a + 1 : number
>a : number
@@ -3,8 +3,7 @@ tests/cases/conformance/jsdoc/0.js(6,5): error TS2322: Type '"hello"' is not ass
tests/cases/conformance/jsdoc/0.js(10,4): error TS2345: Argument of type '"string"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/0.js(17,1): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(20,21): error TS2339: Property 'concat' does not exist on type 'number'.
tests/cases/conformance/jsdoc/0.js(24,7): error TS2322: Type '(a: number) => number' is not assignable to type '(arg0: number) => string'.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(24,19): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsdoc/0.js (6 errors) ====
@@ -42,7 +41,6 @@ tests/cases/conformance/jsdoc/0.js(24,7): error TS2322: Type '(a: number) => num
/** @type {function (number): string} */
const x4 = (a) => a + 1;
~~
!!! error TS2322: Type '(a: number) => number' is not assignable to type '(arg0: number) => string'.
!!! error TS2322: Type 'number' is not assignable to type 'string'.
~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
x4(0);
@@ -13,7 +13,7 @@ var n = "hello";
/** @type {function (number)} */
const x1 = (a) => a + 1;
>x1 : (arg0: number) => any
>(a) => a + 1 : (a: number) => number
>(a) => a + 1 : (a: number) => any
>a : number
>a + 1 : number
>a : number
@@ -47,7 +47,7 @@ a = x2(0);
/** @type {function (number): number} */
const x3 = (a) => a.concat("hi");
>x3 : (arg0: number) => number
>(a) => a.concat("hi") : (a: number) => any
>(a) => a.concat("hi") : (a: number) => number
>a : number
>a.concat("hi") : any
>a.concat : any
@@ -63,7 +63,7 @@ x3(0);
/** @type {function (number): string} */
const x4 = (a) => a + 1;
>x4 : (arg0: number) => string
>(a) => a + 1 : (a: number) => number
>(a) => a + 1 : (a: number) => string
>a : number
>a + 1 : number
>a : number
@@ -4,9 +4,11 @@ tests/cases/conformance/jsdoc/test.js(7,24): error TS2322: Type 'number' is not
tests/cases/conformance/jsdoc/test.js(10,17): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/test.js(12,14): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/test.js(14,24): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/test.js(34,5): error TS2322: Type '1 | 2' is not assignable to type '2 | 3'.
Type '1' is not assignable to type '2 | 3'.
==== tests/cases/conformance/jsdoc/test.js (6 errors) ====
==== tests/cases/conformance/jsdoc/test.js (7 errors) ====
// all 6 should error on return statement/expression
/** @type {(x: number) => string} */
function h(x) { return x }
@@ -33,4 +35,27 @@ tests/cases/conformance/jsdoc/test.js(14,24): error TS2322: Type 'number' is not
var k = function (x) { return x }
~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
/** @type {Argle} */
function blargle(s) {
return 0;
}
/** @type {0 | 1 | 2} - assignment should not error */
var zeroonetwo = blargle('hi')
/** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */
/** @type {Gioconda} */
function monaLisa(sb) {
return typeof sb === 'string' ? 1 : 2;
}
/** @type {2 | 3} - overloads are not supported, so there will be an error */
var twothree = monaLisa(false);
~~~~~~~~
!!! error TS2322: Type '1 | 2' is not assignable to type '2 | 3'.
!!! error TS2322: Type '1' is not assignable to type '2 | 3'.
@@ -36,3 +36,34 @@ var k = function (x) { return x }
>x : Symbol(x, Decl(test.js, 13, 18))
>x : Symbol(x, Decl(test.js, 13, 18))
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
/** @type {Argle} */
function blargle(s) {
>blargle : Symbol(blargle, Decl(test.js, 13, 33))
>s : Symbol(s, Decl(test.js, 18, 17))
return 0;
}
/** @type {0 | 1 | 2} - assignment should not error */
var zeroonetwo = blargle('hi')
>zeroonetwo : Symbol(zeroonetwo, Decl(test.js, 23, 3))
>blargle : Symbol(blargle, Decl(test.js, 13, 33))
/** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */
/** @type {Gioconda} */
function monaLisa(sb) {
>monaLisa : Symbol(monaLisa, Decl(test.js, 23, 30))
>sb : Symbol(sb, Decl(test.js, 28, 18))
return typeof sb === 'string' ? 1 : 2;
>sb : Symbol(sb, Decl(test.js, 28, 18))
}
/** @type {2 | 3} - overloads are not supported, so there will be an error */
var twothree = monaLisa(false);
>twothree : Symbol(twothree, Decl(test.js, 33, 3))
>monaLisa : Symbol(monaLisa, Decl(test.js, 23, 30))
@@ -40,3 +40,45 @@ var k = function (x) { return x }
>x : number
>x : number
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
/** @type {Argle} */
function blargle(s) {
>blargle : (s: "hi" | "bye") => 0 | 1 | 2
>s : "hi" | "bye"
return 0;
>0 : 0
}
/** @type {0 | 1 | 2} - assignment should not error */
var zeroonetwo = blargle('hi')
>zeroonetwo : 0 | 1 | 2
>blargle('hi') : 0 | 1 | 2
>blargle : (s: "hi" | "bye") => 0 | 1 | 2
>'hi' : "hi"
/** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */
/** @type {Gioconda} */
function monaLisa(sb) {
>monaLisa : (sb: any) => 1 | 2
>sb : any
return typeof sb === 'string' ? 1 : 2;
>typeof sb === 'string' ? 1 : 2 : 1 | 2
>typeof sb === 'string' : boolean
>typeof sb : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"
>sb : any
>'string' : "string"
>1 : 1
>2 : 2
}
/** @type {2 | 3} - overloads are not supported, so there will be an error */
var twothree = monaLisa(false);
>twothree : 2 | 3
>monaLisa(false) : 1 | 2
>monaLisa : (sb: any) => 1 | 2
>false : false
@@ -0,0 +1,20 @@
tests/cases/conformance/jsdoc/test.js(1,5): error TS8030: The type of a function declaration must be callable.
tests/cases/conformance/jsdoc/test.js(7,5): error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'.
Property 'prop' is missing in type '(prop: any) => void'.
==== tests/cases/conformance/jsdoc/test.js (2 errors) ====
/** @type {number} */
~~~~~~~~~~~~~~
!!! error TS8030: The type of a function declaration must be callable.
function f() {
return 1
}
/** @type {{ prop: string }} */
var g = function (prop) {
~
!!! error TS2322: Type '(prop: any) => void' is not assignable to type '{ prop: string; }'.
!!! error TS2322: Property 'prop' is missing in type '(prop: any) => void'.
}
@@ -0,0 +1,14 @@
=== tests/cases/conformance/jsdoc/test.js ===
/** @type {number} */
function f() {
>f : Symbol(f, Decl(test.js, 0, 0))
return 1
}
/** @type {{ prop: string }} */
var g = function (prop) {
>g : Symbol(g, Decl(test.js, 6, 3))
>prop : Symbol(prop, Decl(test.js, 6, 18))
}
@@ -0,0 +1,16 @@
=== tests/cases/conformance/jsdoc/test.js ===
/** @type {number} */
function f() {
>f : () => number
return 1
>1 : 1
}
/** @type {{ prop: string }} */
var g = function (prop) {
>g : { prop: string; }
>function (prop) {} : (prop: any) => void
>prop : any
}
@@ -1,8 +1,6 @@
tests/cases/conformance/jsdoc/0.js(5,3): error TS2322: Type 'number' is not assignable to type 'string | undefined'.
tests/cases/conformance/jsdoc/0.js(7,3): error TS2322: Type '(n1: number) => string' is not assignable to type '(arg0: number) => number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(11,3): error TS2322: Type '(n1: number) => string' is not assignable to type '(arg0: number) => number'.
Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(8,7): error TS2322: Type '"42"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(11,20): error TS2322: Type '"lol"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(13,15): error TS2322: Type '"0"' is not assignable to type 'number'.
tests/cases/conformance/jsdoc/0.js(15,3): error TS2322: Type 'undefined' is not assignable to type 'string'.
tests/cases/conformance/jsdoc/0.js(19,5): error TS2322: Type 'number' is not assignable to type 'string'.
@@ -19,16 +17,14 @@ tests/cases/conformance/jsdoc/0.js(22,22): error TS2345: Argument of type '"0"'
!!! error TS2322: Type 'number' is not assignable to type 'string | undefined'.
/** @type {function(number): number} */
method1(n1) {
~~~~~~~
!!! error TS2322: Type '(n1: number) => string' is not assignable to type '(arg0: number) => number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
return "42";
~~~~~~~~~~~~
!!! error TS2322: Type '"42"' is not assignable to type 'number'.
},
/** @type {function(number): number} */
method2: (n1) => "lol",
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '(n1: number) => string' is not assignable to type '(arg0: number) => number'.
!!! error TS2322: Type 'string' is not assignable to type 'number'.
~~~~~
!!! error TS2322: Type '"lol"' is not assignable to type 'number'.
/** @type {function(number): number} */
arrowFunc: (num="0") => num + 42,
~~~~~~~
@@ -14,7 +14,7 @@ const obj = {
/** @type {function(number): number} */
method1(n1) {
>method1 : (n1: number) => string
>method1 : (n1: number) => number
>n1 : number
return "42";
@@ -24,7 +24,7 @@ const obj = {
/** @type {function(number): number} */
method2: (n1) => "lol",
>method2 : (arg0: number) => number
>(n1) => "lol" : (n1: number) => string
>(n1) => "lol" : (n1: number) => number
>n1 : number
>"lol" : "lol"
@@ -0,0 +1,24 @@
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(8,5): error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts(9,33): error TS2322: Type 'A' is not assignable to type 'Something<A>["arr"]'.
Type 'object' is not assignable to type 'Something<A>["arr"]'.
==== tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts (2 errors) ====
type Something<T> = { test: string } & (T extends object ? {
arg: T
} : {
arg?: undefined
});
function testFunc2<A extends object>(a: A, sa: Something<A>) {
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
~~
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'Something<A>'.
!!! error TS2322: Type '{ test: string; arg: A; }' is not assignable to type 'A extends object ? { arg: A; } : { arg?: undefined; }'.
sa = { test: 'bye', arg: a, arr: a } // excess
~~~
!!! error TS2322: Type 'A' is not assignable to type 'Something<A>["arr"]'.
!!! error TS2322: Type 'object' is not assignable to type 'Something<A>["arr"]'.
}
@@ -0,0 +1,18 @@
//// [conditionalTypesExcessProperties.ts]
type Something<T> = { test: string } & (T extends object ? {
arg: T
} : {
arg?: undefined
});
function testFunc2<A extends object>(a: A, sa: Something<A>) {
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
sa = { test: 'bye', arg: a, arr: a } // excess
}
//// [conditionalTypesExcessProperties.js]
function testFunc2(a, sa) {
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
sa = { test: 'bye', arg: a, arr: a }; // excess
}
@@ -0,0 +1,41 @@
=== tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts ===
type Something<T> = { test: string } & (T extends object ? {
>Something : Symbol(Something, Decl(conditionalTypesExcessProperties.ts, 0, 0))
>T : Symbol(T, Decl(conditionalTypesExcessProperties.ts, 0, 15))
>test : Symbol(test, Decl(conditionalTypesExcessProperties.ts, 0, 21))
>T : Symbol(T, Decl(conditionalTypesExcessProperties.ts, 0, 15))
arg: T
>arg : Symbol(arg, Decl(conditionalTypesExcessProperties.ts, 0, 61))
>T : Symbol(T, Decl(conditionalTypesExcessProperties.ts, 0, 15))
} : {
arg?: undefined
>arg : Symbol(arg, Decl(conditionalTypesExcessProperties.ts, 2, 5))
});
function testFunc2<A extends object>(a: A, sa: Something<A>) {
>testFunc2 : Symbol(testFunc2, Decl(conditionalTypesExcessProperties.ts, 4, 7))
>A : Symbol(A, Decl(conditionalTypesExcessProperties.ts, 6, 19))
>a : Symbol(a, Decl(conditionalTypesExcessProperties.ts, 6, 37))
>A : Symbol(A, Decl(conditionalTypesExcessProperties.ts, 6, 19))
>sa : Symbol(sa, Decl(conditionalTypesExcessProperties.ts, 6, 42))
>Something : Symbol(Something, Decl(conditionalTypesExcessProperties.ts, 0, 0))
>A : Symbol(A, Decl(conditionalTypesExcessProperties.ts, 6, 19))
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
>sa : Symbol(sa, Decl(conditionalTypesExcessProperties.ts, 6, 42))
>test : Symbol(test, Decl(conditionalTypesExcessProperties.ts, 7, 10))
>arg : Symbol(arg, Decl(conditionalTypesExcessProperties.ts, 7, 22))
>a : Symbol(a, Decl(conditionalTypesExcessProperties.ts, 6, 37))
sa = { test: 'bye', arg: a, arr: a } // excess
>sa : Symbol(sa, Decl(conditionalTypesExcessProperties.ts, 6, 42))
>test : Symbol(test, Decl(conditionalTypesExcessProperties.ts, 8, 10))
>arg : Symbol(arg, Decl(conditionalTypesExcessProperties.ts, 8, 23))
>a : Symbol(a, Decl(conditionalTypesExcessProperties.ts, 6, 37))
>arr : Symbol(arr, Decl(conditionalTypesExcessProperties.ts, 8, 31))
>a : Symbol(a, Decl(conditionalTypesExcessProperties.ts, 6, 37))
}
@@ -0,0 +1,47 @@
=== tests/cases/conformance/types/conditional/conditionalTypesExcessProperties.ts ===
type Something<T> = { test: string } & (T extends object ? {
>Something : Something<T>
>T : T
>test : string
>T : T
arg: T
>arg : T
>T : T
} : {
arg?: undefined
>arg : undefined
});
function testFunc2<A extends object>(a: A, sa: Something<A>) {
>testFunc2 : <A extends object>(a: A, sa: Something<A>) => void
>A : A
>a : A
>A : A
>sa : Something<A>
>Something : Something<T>
>A : A
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
>sa = { test: 'hi', arg: a } : { test: string; arg: A; }
>sa : Something<A>
>{ test: 'hi', arg: a } : { test: string; arg: A; }
>test : string
>'hi' : "hi"
>arg : A
>a : A
sa = { test: 'bye', arg: a, arr: a } // excess
>sa = { test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
>sa : Something<A>
>{ test: 'bye', arg: a, arr: a } : { test: string; arg: A; arr: A; }
>test : string
>'bye' : "bye"
>arg : A
>a : A
>arr : A
>a : A
}
@@ -1,12 +1,14 @@
//// [destructuringTempOccursAfterPrologue.ts]
function test(p: any) {
'use strict';
'use strong';
p = { prop: p } = p;
}
//// [destructuringTempOccursAfterPrologue.js]
function test(p) {
'use strict';
'use strong';
var _a;
p = (_a = p, p = _a.prop, _a);
}
@@ -4,9 +4,10 @@ function test(p: any) {
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
'use strict';
'use strong';
p = { prop: p } = p;
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
>prop : Symbol(prop, Decl(destructuringTempOccursAfterPrologue.ts, 2, 9))
>prop : Symbol(prop, Decl(destructuringTempOccursAfterPrologue.ts, 3, 9))
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
>p : Symbol(p, Decl(destructuringTempOccursAfterPrologue.ts, 0, 14))
}
@@ -6,6 +6,9 @@ function test(p: any) {
'use strict';
>'use strict' : "use strict"
'use strong';
>'use strong' : "use strong"
p = { prop: p } = p;
>p = { prop: p } = p : any
>p : any
@@ -0,0 +1,39 @@
tests/cases/compiler/functionParameterArityMismatch.ts(3,1): error TS2554: Expected 1-3 arguments, but got 0.
tests/cases/compiler/functionParameterArityMismatch.ts(4,1): error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(5,1): error TS2554: Expected 1-3 arguments, but got 4.
tests/cases/compiler/functionParameterArityMismatch.ts(11,1): error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(12,1): error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(13,1): error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments.
tests/cases/compiler/functionParameterArityMismatch.ts(14,1): error TS2554: Expected 0-6 arguments, but got 7.
==== tests/cases/compiler/functionParameterArityMismatch.ts (7 errors) ====
declare function f1(a: number);
declare function f1(a: number, b: number, c: number);
f1();
~~~~
!!! error TS2554: Expected 1-3 arguments, but got 0.
f1(1, 2);
~~~~~~~~
!!! error TS2575: No overload expects 2 arguments, but overloads do exist that expect either 1 or 3 arguments.
f1(1, 2, 3, 4);
~~~~~~~~~~~~~~
!!! error TS2554: Expected 1-3 arguments, but got 4.
declare function f2();
declare function f2(a: number, b: number);
declare function f2(a: number, b: number, c: number, d: number);
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
f2(1);
~~~~~
!!! error TS2575: No overload expects 1 arguments, but overloads do exist that expect either 0 or 2 arguments.
f2(1, 2, 3);
~~~~~~~~~~~
!!! error TS2575: No overload expects 3 arguments, but overloads do exist that expect either 2 or 4 arguments.
f2(1, 2, 3, 4, 5);
~~~~~~~~~~~~~~~~~
!!! error TS2575: No overload expects 5 arguments, but overloads do exist that expect either 4 or 6 arguments.
f2(1, 2, 3, 4, 5, 6, 7);
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 0-6 arguments, but got 7.
@@ -0,0 +1,25 @@
//// [functionParameterArityMismatch.ts]
declare function f1(a: number);
declare function f1(a: number, b: number, c: number);
f1();
f1(1, 2);
f1(1, 2, 3, 4);
declare function f2();
declare function f2(a: number, b: number);
declare function f2(a: number, b: number, c: number, d: number);
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
f2(1);
f2(1, 2, 3);
f2(1, 2, 3, 4, 5);
f2(1, 2, 3, 4, 5, 6, 7);
//// [functionParameterArityMismatch.js]
f1();
f1(1, 2);
f1(1, 2, 3, 4);
f2(1);
f2(1, 2, 3);
f2(1, 2, 3, 4, 5);
f2(1, 2, 3, 4, 5, 6, 7);
@@ -0,0 +1,56 @@
=== tests/cases/compiler/functionParameterArityMismatch.ts ===
declare function f1(a: number);
>f1 : Symbol(f1, Decl(functionParameterArityMismatch.ts, 0, 0), Decl(functionParameterArityMismatch.ts, 0, 31))
>a : Symbol(a, Decl(functionParameterArityMismatch.ts, 0, 20))
declare function f1(a: number, b: number, c: number);
>f1 : Symbol(f1, Decl(functionParameterArityMismatch.ts, 0, 0), Decl(functionParameterArityMismatch.ts, 0, 31))
>a : Symbol(a, Decl(functionParameterArityMismatch.ts, 1, 20))
>b : Symbol(b, Decl(functionParameterArityMismatch.ts, 1, 30))
>c : Symbol(c, Decl(functionParameterArityMismatch.ts, 1, 41))
f1();
>f1 : Symbol(f1, Decl(functionParameterArityMismatch.ts, 0, 0), Decl(functionParameterArityMismatch.ts, 0, 31))
f1(1, 2);
>f1 : Symbol(f1, Decl(functionParameterArityMismatch.ts, 0, 0), Decl(functionParameterArityMismatch.ts, 0, 31))
f1(1, 2, 3, 4);
>f1 : Symbol(f1, Decl(functionParameterArityMismatch.ts, 0, 0), Decl(functionParameterArityMismatch.ts, 0, 31))
declare function f2();
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
declare function f2(a: number, b: number);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
>a : Symbol(a, Decl(functionParameterArityMismatch.ts, 7, 20))
>b : Symbol(b, Decl(functionParameterArityMismatch.ts, 7, 30))
declare function f2(a: number, b: number, c: number, d: number);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
>a : Symbol(a, Decl(functionParameterArityMismatch.ts, 8, 20))
>b : Symbol(b, Decl(functionParameterArityMismatch.ts, 8, 30))
>c : Symbol(c, Decl(functionParameterArityMismatch.ts, 8, 41))
>d : Symbol(d, Decl(functionParameterArityMismatch.ts, 8, 52))
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
>a : Symbol(a, Decl(functionParameterArityMismatch.ts, 9, 20))
>b : Symbol(b, Decl(functionParameterArityMismatch.ts, 9, 30))
>c : Symbol(c, Decl(functionParameterArityMismatch.ts, 9, 41))
>d : Symbol(d, Decl(functionParameterArityMismatch.ts, 9, 52))
>e : Symbol(e, Decl(functionParameterArityMismatch.ts, 9, 63))
>f : Symbol(f, Decl(functionParameterArityMismatch.ts, 9, 74))
f2(1);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
f2(1, 2, 3);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
f2(1, 2, 3, 4, 5);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
f2(1, 2, 3, 4, 5, 6, 7);
>f2 : Symbol(f2, Decl(functionParameterArityMismatch.ts, 4, 15), Decl(functionParameterArityMismatch.ts, 6, 22), Decl(functionParameterArityMismatch.ts, 7, 42), Decl(functionParameterArityMismatch.ts, 8, 64))
@@ -0,0 +1,85 @@
=== tests/cases/compiler/functionParameterArityMismatch.ts ===
declare function f1(a: number);
>f1 : { (a: number): any; (a: number, b: number, c: number): any; }
>a : number
declare function f1(a: number, b: number, c: number);
>f1 : { (a: number): any; (a: number, b: number, c: number): any; }
>a : number
>b : number
>c : number
f1();
>f1() : any
>f1 : { (a: number): any; (a: number, b: number, c: number): any; }
f1(1, 2);
>f1(1, 2) : any
>f1 : { (a: number): any; (a: number, b: number, c: number): any; }
>1 : 1
>2 : 2
f1(1, 2, 3, 4);
>f1(1, 2, 3, 4) : any
>f1 : { (a: number): any; (a: number, b: number, c: number): any; }
>1 : 1
>2 : 2
>3 : 3
>4 : 4
declare function f2();
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
declare function f2(a: number, b: number);
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>a : number
>b : number
declare function f2(a: number, b: number, c: number, d: number);
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>a : number
>b : number
>c : number
>d : number
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>a : number
>b : number
>c : number
>d : number
>e : number
>f : number
f2(1);
>f2(1) : any
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>1 : 1
f2(1, 2, 3);
>f2(1, 2, 3) : any
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>1 : 1
>2 : 2
>3 : 3
f2(1, 2, 3, 4, 5);
>f2(1, 2, 3, 4, 5) : any
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>1 : 1
>2 : 2
>3 : 3
>4 : 4
>5 : 5
f2(1, 2, 3, 4, 5, 6, 7);
>f2(1, 2, 3, 4, 5, 6, 7) : any
>f2 : { (): any; (a: number, b: number): any; (a: number, b: number, c: number, d: number): any; (a: number, b: number, c: number, d: number, e: number, f: number): any; }
>1 : 1
>2 : 2
>3 : 3
>4 : 4
>5 : 5
>6 : 6
>7 : 7
@@ -1,4 +1,4 @@
tests/cases/conformance/types/import/importTypeAmbientMissing.ts(8,10): error TS2307: Cannot find module 'fo'.
tests/cases/conformance/types/import/importTypeAmbientMissing.ts(8,17): error TS2307: Cannot find module 'fo'.
==== tests/cases/conformance/types/import/importTypeAmbientMissing.ts (1 errors) ====
@@ -10,7 +10,7 @@ tests/cases/conformance/types/import/importTypeAmbientMissing.ts(8,10): error TS
export = Point;
}
const x: import("fo") = { x: 0, y: 0 }; // typo, error
~~~~~~~~~~~~
~~~~
!!! error TS2307: Cannot find module 'fo'.
@@ -1,7 +1,7 @@
tests/cases/conformance/types/import/usage.ts(1,17): error TS2307: Cannot find module './fo'.
tests/cases/conformance/types/import/usage.ts(2,15): error TS2307: Cannot find module './fo2'.
tests/cases/conformance/types/import/usage.ts(1,24): error TS2307: Cannot find module './fo'.
tests/cases/conformance/types/import/usage.ts(2,22): error TS2307: Cannot find module './fo2'.
tests/cases/conformance/types/import/usage.ts(3,36): error TS2694: Namespace '"tests/cases/conformance/types/import/foo2".Bar' has no exported member 'Q'.
tests/cases/conformance/types/import/usage.ts(10,18): error TS2307: Cannot find module './fo2'.
tests/cases/conformance/types/import/usage.ts(10,32): error TS2307: Cannot find module './fo2'.
==== tests/cases/conformance/types/import/foo.ts (0 errors) ====
@@ -34,10 +34,10 @@ tests/cases/conformance/types/import/usage.ts(10,18): error TS2307: Cannot find
==== tests/cases/conformance/types/import/usage.ts (4 errors) ====
export const x: import("./fo") = { x: 0, y: 0 };
~~~~~~~~~~~~~~
~~~~~~
!!! error TS2307: Cannot find module './fo'.
export let y: import("./fo2").Bar.I = { a: "", b: 0 };
~~~~~~~~~~~~~~~~~~~~~
~~~~~~~
!!! error TS2307: Cannot find module './fo2'.
export let z: import("./foo2").Bar.Q = { a: "", b: 0 };
~
@@ -49,7 +49,7 @@ tests/cases/conformance/types/import/usage.ts(10,18): error TS2307: Cannot find
}
export let shim: typeof import("./fo2") = {
~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~
!!! error TS2307: Cannot find module './fo2'.
Bar: Bar2
};
@@ -1,5 +1,5 @@
tests/cases/compiler/metadataImportType.ts(2,6): error TS2304: Cannot find name 'test'.
tests/cases/compiler/metadataImportType.ts(3,8): error TS2307: Cannot find module './b'.
tests/cases/compiler/metadataImportType.ts(3,15): error TS2307: Cannot find module './b'.
==== tests/cases/compiler/metadataImportType.ts (2 errors) ====
@@ -8,6 +8,6 @@ tests/cases/compiler/metadataImportType.ts(3,8): error TS2307: Cannot find modul
~~~~
!!! error TS2304: Cannot find name 'test'.
b: import('./b').B
~~~~~~~~~~~~~~~
~~~~~
!!! error TS2307: Cannot find module './b'.
}
@@ -2,6 +2,10 @@ tests/cases/conformance/salsa/a.js(4,17): error TS2339: Property 'toFixed' does
Property 'toFixed' does not exist on type 'string'.
tests/cases/conformance/salsa/a.js(5,16): error TS2339: Property 'toFixed' does not exist on type 'string | number'.
Property 'toFixed' does not exist on type 'string'.
tests/cases/conformance/salsa/mod1.js(2,1): error TS2323: Cannot redeclare exported variable 'bothBefore'.
tests/cases/conformance/salsa/mod1.js(4,1): error TS2323: Cannot redeclare exported variable 'bothBefore'.
tests/cases/conformance/salsa/mod1.js(5,1): error TS2323: Cannot redeclare exported variable 'bothAfter'.
tests/cases/conformance/salsa/mod1.js(10,1): error TS2323: Cannot redeclare exported variable 'bothAfter'.
==== tests/cases/conformance/salsa/a.js (2 errors) ====
@@ -21,16 +25,24 @@ tests/cases/conformance/salsa/a.js(5,16): error TS2339: Property 'toFixed' does
==== tests/cases/conformance/salsa/requires.d.ts (0 errors) ====
declare var module: { exports: any };
declare function require(name: string): any;
==== tests/cases/conformance/salsa/mod1.js (0 errors) ====
==== tests/cases/conformance/salsa/mod1.js (4 errors) ====
/// <reference path='./requires.d.ts' />
module.exports.bothBefore = 'string'
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'bothBefore'.
A.justExport = 4
A.bothBefore = 2
~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'bothBefore'.
A.bothAfter = 3
~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'bothAfter'.
module.exports = A
function A() {
this.p = 1
}
module.exports.bothAfter = 'string'
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Cannot redeclare exported variable 'bothAfter'.
module.exports.justProperty = 'string'
@@ -81,7 +81,7 @@ export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context/src/
tests/cases/compiler/monorepo/context/src/bindingkey.d.ts(1,29): error TS2307: Cannot find module '@loopback/context'.
tests/cases/compiler/monorepo/core/src/application.d.ts(1,29): error TS2307: Cannot find module '@loopback/context'.
tests/cases/compiler/monorepo/core/src/usage.d.ts(1,28): error TS2307: Cannot find module '@loopback/context'.
tests/cases/compiler/monorepo/core/src/usage.d.ts(2,51): error TS2307: Cannot find module '@loopback/context/src/value-promise'.
tests/cases/compiler/monorepo/core/src/usage.d.ts(2,58): error TS2307: Cannot find module '@loopback/context/src/value-promise'.
==== tests/cases/compiler/monorepo/core/src/application.d.ts (1 errors) ====
@@ -95,7 +95,7 @@ tests/cases/compiler/monorepo/core/src/usage.d.ts(2,51): error TS2307: Cannot fi
~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module '@loopback/context'.
export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context/src/value-promise").Constructor<any>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module '@loopback/context/src/value-promise'.
==== /.src/tests/cases/compiler/monorepo/context/src/value-promise.d.ts (0 errors) ====
@@ -47,7 +47,7 @@ export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context/src/
tests/cases/compiler/monorepo/core/dist/src/application.d.ts(1,29): error TS2307: Cannot find module '@loopback/context'.
tests/cases/compiler/monorepo/core/dist/src/usage.d.ts(1,28): error TS2307: Cannot find module '@loopback/context'.
tests/cases/compiler/monorepo/core/dist/src/usage.d.ts(2,51): error TS2307: Cannot find module '@loopback/context/src/value-promise'.
tests/cases/compiler/monorepo/core/dist/src/usage.d.ts(2,58): error TS2307: Cannot find module '@loopback/context/src/value-promise'.
==== tests/cases/compiler/monorepo/core/tsconfig.json (0 errors) ====
@@ -82,6 +82,6 @@ tests/cases/compiler/monorepo/core/dist/src/usage.d.ts(2,51): error TS2307: Cann
~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module '@loopback/context'.
export declare const CONTROLLER_CLASS: BindingKey<import("@loopback/context/src/value-promise").Constructor<any>>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module '@loopback/context/src/value-promise'.
@@ -35,6 +35,6 @@ function g(vvvvv) {
/** @type {Cb} */
const cb = x => {}
>cb : Cb
>x => {} : (x: any) => void
>x => {} : (x: any) => any
>x : any
+4 -4
View File
@@ -1,7 +1,7 @@
=== tests/cases/conformance/externalModules/err1.d.ts ===
// Illegal, can't be in script file
export as namespace Foo;
>Foo : No type information available!
>Foo : any
=== tests/cases/conformance/externalModules/err2.d.ts ===
// Illegal, can't be in external ambient module
@@ -9,7 +9,7 @@ declare module "Foo" {
>"Foo" : typeof import("Foo")
export as namespace Bar;
>Bar : No type information available!
>Bar : any
}
=== tests/cases/conformance/externalModules/err3.d.ts ===
@@ -35,7 +35,7 @@ export namespace B {
>B : typeof B
export as namespace C1;
>C1 : No type information available!
>C1 : any
}
=== tests/cases/conformance/externalModules/err5.ts ===
@@ -44,6 +44,6 @@ export var v;
>v : any
export as namespace C2;
>C2 : No type information available!
>C2 : any
+3 -3
View File
@@ -125,8 +125,8 @@ node_modules/async/dist/async.js(2116,20): error TS2345: Argument of type 'Funct
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(2425,20): error TS1005: '}' expected.
node_modules/async/dist/async.js(2450,5): error TS2322: Type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturat...' is not assignable to type 'NodeModule'.
Property 'exports' is missing in type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturat...'.
node_modules/async/dist/async.js(2450,5): error TS2322: Type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturated: () => void; buffer: number; empty: () => void; drain: () => void; error: () => void; started: boolean; paused: boolean; ... 10 more ...; resume: () => void; }' is not assignable to type 'NodeModule'.
Property 'exports' is missing in type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturated: () => void; buffer: number; empty: () => void; drain: () => void; error: () => void; started: boolean; paused: boolean; ... 10 more ...; resume: () => void; }'.
node_modules/async/dist/async.js(2521,9): error TS2722: Cannot invoke an object which is possibly 'undefined'.
node_modules/async/dist/async.js(2564,31): error TS2345: Argument of type 'IArguments' is not assignable to parameter of type 'any[]'.
Property 'push' is missing in type 'IArguments'.
@@ -160,7 +160,7 @@ node_modules/async/dist/async.js(3848,23): error TS1003: Identifier expected.
node_modules/async/dist/async.js(3848,24): error TS1003: Identifier expected.
node_modules/async/dist/async.js(3848,25): error TS1003: Identifier expected.
node_modules/async/dist/async.js(4059,20): error TS1005: '}' expected.
node_modules/async/dist/async.js(4095,5): error TS2322: Type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturat...' is not assignable to type 'NodeModule'.
node_modules/async/dist/async.js(4095,5): error TS2322: Type '{ [x: string]: any; _tasks: DLL; concurrency: any; payload: any; saturated: () => void; unsaturated: () => void; buffer: number; empty: () => void; drain: () => void; error: () => void; started: boolean; paused: boolean; ... 10 more ...; resume: () => void; }' is not assignable to type 'NodeModule'.
node_modules/async/dist/async.js(4117,20): error TS1005: '}' expected.
node_modules/async/dist/async.js(4128,7): error TS2339: Property 'push' does not exist on type 'NodeModule'.
node_modules/async/dist/async.js(4133,11): error TS2339: Property 'started' does not exist on type 'NodeModule'.
+7 -7
View File
@@ -24,9 +24,9 @@ node_modules/bluebird/js/release/debuggability.js(745,37): error TS2339: Propert
node_modules/bluebird/js/release/debuggability.js(784,38): error TS2339: Property 'stack' does not exist on type 'CapturedTrace'.
node_modules/bluebird/js/release/debuggability.js(793,25): error TS2554: Expected 0 arguments, but got 1.
node_modules/bluebird/js/release/errors.js(10,49): error TS2350: Only a void function can be called with the 'new' keyword.
node_modules/bluebird/js/release/errors.js(46,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ...' has no compatible call signatures.
node_modules/bluebird/js/release/errors.js(92,18): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; } | ((obj...' has no compatible call signatures.
node_modules/bluebird/js/release/errors.js(99,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ...' has no compatible call signatures.
node_modules/bluebird/js/release/errors.js(46,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/errors.js(92,18): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ <T>(a: T[]): ReadonlyArray<T>; <T extends Function>(f: T): T; <T>(o: T): Readonly<T>; } | ((obj: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/errors.js(99,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/generators.js(159,21): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/generators.js(190,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/generators.js(208,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
@@ -52,7 +52,7 @@ node_modules/bluebird/js/release/promise.js(4,12): error TS2351: Cannot use 'new
node_modules/bluebird/js/release/promise.js(7,24): error TS2339: Property 'PromiseInspection' does not exist on type 'typeof Promise'.
node_modules/bluebird/js/release/promise.js(10,27): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/promise.js(20,32): error TS2322: Type 'null' is not assignable to type 'Domain'.
node_modules/bluebird/js/release/promise.js(33,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ...' has no compatible call signatures.
node_modules/bluebird/js/release/promise.js(33,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/promise.js(62,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/promise.js(65,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/promise.js(123,14): error TS2339: Property '_warn' does not exist on type 'Promise'.
@@ -155,10 +155,10 @@ node_modules/bluebird/js/release/some.js(133,23): error TS2339: Property 'promis
node_modules/bluebird/js/release/using.js(78,20): error TS2339: Property 'doDispose' does not exist on type 'Disposer'.
node_modules/bluebird/js/release/using.js(97,23): error TS2339: Property 'data' does not exist on type 'FunctionDisposer'.
node_modules/bluebird/js/release/using.js(223,15): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
node_modules/bluebird/js/release/util.js(97,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ...' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(97,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(247,28): error TS2554: Expected 0 arguments, but got 2.
node_modules/bluebird/js/release/util.js(275,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ...' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(275,45): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol) => PropertyDescriptor | undefined) | ((o: any, key: any) =...' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(275,17): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol, attributes: PropertyDescriptor & ThisType<any>) => any) | ((o: any, key: any, desc: any) => any)' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(275,45): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((o: any, p: string | number | symbol) => PropertyDescriptor | undefined) | ((o: any, key: any) => { [x: string]: any; value: any; })' has no compatible call signatures.
node_modules/bluebird/js/release/util.js(363,25): error TS2304: Cannot find name 'chrome'.
node_modules/bluebird/js/release/util.js(363,51): error TS2304: Cannot find name 'chrome'.
node_modules/bluebird/js/release/util.js(364,25): error TS2304: Cannot find name 'chrome'.
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -17,11 +17,11 @@ node_modules/debug/src/debug.js(46,13): error TS2407: The right-hand side of a '
node_modules/debug/src/debug.js(47,57): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
node_modules/debug/src/debug.js(51,18): error TS2339: Property 'colors' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'.
node_modules/debug/src/debug.js(51,50): error TS2339: Property 'colors' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'.
node_modules/debug/src/debug.js(75,10): error TS2339: Property 'diff' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; des...'.
node_modules/debug/src/debug.js(76,10): error TS2339: Property 'prev' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; des...'.
node_modules/debug/src/debug.js(77,10): error TS2339: Property 'curr' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; des...'.
node_modules/debug/src/debug.js(75,10): error TS2339: Property 'diff' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; destroy: () => boolean; }'.
node_modules/debug/src/debug.js(76,10): error TS2339: Property 'prev' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; destroy: () => boolean; }'.
node_modules/debug/src/debug.js(77,10): error TS2339: Property 'curr' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; destroy: () => boolean; }'.
node_modules/debug/src/debug.js(112,13): error TS2551: Property 'formatArgs' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'. Did you mean 'formatters'?
node_modules/debug/src/debug.js(114,23): error TS2339: Property 'log' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; des...'.
node_modules/debug/src/debug.js(114,23): error TS2339: Property 'log' does not exist on type '{ (...args: any[]): void; namespace: string; enabled: boolean; useColors: any; color: number; destroy: () => boolean; }'.
node_modules/debug/src/debug.js(114,38): error TS2339: Property 'log' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'.
node_modules/debug/src/debug.js(120,29): error TS2339: Property 'useColors' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'.
node_modules/debug/src/debug.js(125,37): error TS2339: Property 'init' does not exist on type 'typeof import("/debug/node_modules/debug/src/debug")'.
+27 -27
View File
@@ -273,33 +273,33 @@ node_modules/lodash/fp/_baseConvert.js(144,5): error TS2559: Type 'Function' has
node_modules/lodash/fp/_baseConvert.js(145,5): error TS2322: Type 'string' is not assignable to type 'Function'.
node_modules/lodash/fp/_baseConvert.js(146,5): error TS2322: Type 'undefined' is not assignable to type 'string'.
node_modules/lodash/fp/_baseConvert.js(165,31): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(184,21): error TS2339: Property 'ary' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(184,21): error TS2339: Property 'ary' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'ary' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(185,24): error TS2339: Property 'assign' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(185,24): error TS2339: Property 'assign' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'assign' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(186,23): error TS2339: Property 'clone' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(186,23): error TS2339: Property 'clone' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'clone' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(187,23): error TS2339: Property 'curry' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(187,23): error TS2339: Property 'curry' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'curry' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(188,22): error TS2339: Property 'forEach' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(188,22): error TS2339: Property 'forEach' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'forEach' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(189,25): error TS2339: Property 'isArray' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(189,25): error TS2339: Property 'isArray' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isArray' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(190,25): error TS2339: Property 'isError' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(190,25): error TS2339: Property 'isError' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isError' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(191,28): error TS2339: Property 'isFunction' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(191,28): error TS2339: Property 'isFunction' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isFunction' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(192,27): error TS2339: Property 'isWeakMap' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(192,27): error TS2339: Property 'isWeakMap' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'isWeakMap' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(193,22): error TS2339: Property 'keys' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(193,22): error TS2339: Property 'keys' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'keys' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(194,23): error TS2339: Property 'rearg' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(194,23): error TS2339: Property 'rearg' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'rearg' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(195,27): error TS2339: Property 'toInteger' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(195,27): error TS2339: Property 'toInteger' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'toInteger' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(196,24): error TS2339: Property 'toPath' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': ...'.
node_modules/lodash/fp/_baseConvert.js(196,24): error TS2339: Property 'toPath' does not exist on type 'Function | { [x: string]: any; 'ary': any; 'assign': any; 'clone': any; 'curry': any; 'forEach': any; 'isArray': any; 'isError': any; 'isFunction': any; 'isWeakMap': any; 'iteratee': any; 'keys': any; 'rearg': any; 'toInteger': any; 'toPath': any; }'.
Property 'toPath' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(263,57): error TS2345: Argument of type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; } | unde...' is not assignable to parameter of type 'Function'.
node_modules/lodash/fp/_baseConvert.js(263,57): error TS2345: Argument of type '{ cap?: boolean; curry?: boolean; fixed?: boolean; immutable?: boolean; rearg?: boolean; } | undefined' is not assignable to parameter of type 'Function'.
Type 'undefined' is not assignable to type 'Function'.
node_modules/lodash/fp/_baseConvert.js(379,14): error TS2339: Property 'runInContext' does not exist on type 'Function'.
node_modules/lodash/fp/_baseConvert.js(516,33): error TS2339: Property 'placeholder' does not exist on type 'Function'.
@@ -310,19 +310,19 @@ node_modules/lodash/fp/_convertBrowser.js(15,12): error TS2304: Cannot find name
node_modules/lodash/fp/_convertBrowser.js(15,38): error TS2304: Cannot find name '_'.
node_modules/lodash/fp/_convertBrowser.js(16,3): error TS2304: Cannot find name '_'.
node_modules/lodash/fp/_convertBrowser.js(16,22): error TS2304: Cannot find name '_'.
node_modules/lodash/fp/array.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'chunk': (array: any[], size?: number | undefined, guard: any) => any[]; 'com...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/collection.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'countBy': Function; 'each': (collection: any, iteratee?: Function | undefine...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/array.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'chunk': (array: any[], size?: number | undefined, guard: any) => any[]; 'compact': (array: any[]) => any[]; 'concat': (...args: any[]) => any[]; 'difference': Function; 'differenceBy': Function; 'differenceWith': Function; ... 58 more ...; 'zipWith': Function; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/collection.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'countBy': Function; 'each': (collection: any, iteratee?: Function | undefined) => any; 'eachRight': (collection: any, iteratee?: Function | undefined) => any; 'every': (collection: any, predicate?: Function | undefined, guard: any) => boolean; ... 23 more ...; 'sortBy': Function; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/convert.js(15,34): error TS2345: Argument of type 'Function | undefined' is not assignable to parameter of type 'Function'.
Type 'undefined' is not assignable to type 'Function'.
node_modules/lodash/fp/date.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'now': () => number; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/function.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'after': (n: number, func: Function) => Function; 'ary': (func: Function, n?:...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/lang.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'castArray': (...args: any[]) => any[]; 'clone': (value: any) => any; 'cloneD...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/math.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'add': Function; 'ceil': Function; 'divide': Function; 'floor': Function; 'ma...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/number.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'clamp': (number: number, lower?: number | undefined, upper: number) => numbe...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/object.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'assign': Function; 'assignIn': Function; 'assignInWith': Function; 'assignWi...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/seq.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'at': Function; 'chain': (value: any) => any; 'commit': () => any; 'lodash': ...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/string.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'camelCase': Function; 'capitalize': (string?: string | undefined) => string;...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/util.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'attempt': Function; 'bindAll': Function; 'cond': (pairs: any[]) => Function;...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/function.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'after': (n: number, func: Function) => Function; 'ary': (func: Function, n?: number | undefined, guard: any) => Function; 'before': (n: number, func: Function) => Function; ... 19 more ...; 'wrap': (value: any, wrapper?: Function | undefined) => Function; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/lang.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'castArray': (...args: any[]) => any[]; 'clone': (value: any) => any; 'cloneDeep': (value: any) => any; 'cloneDeepWith': (value: any, customizer?: Function | undefined) => any; 'cloneWith': (value: any, customizer?: Function | undefined) => any; ... 50 more ...; 'toString': (value: any) => string...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/math.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'add': Function; 'ceil': Function; 'divide': Function; 'floor': Function; 'max': (array: any[]) => any; 'maxBy': (array: any[], iteratee?: Function | undefined) => any; 'mean': (array: any[]) => number; ... 7 more ...; 'sumBy': (array: any[], iteratee?: Function | undefined) => number; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/number.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'clamp': (number: number, lower?: number | undefined, upper: number) => number; 'inRange': (number: number, start?: number | undefined, end: number) => boolean; 'random': (lower?: number | undefined, upper?: number | undefined, floating?: boolean | undefined) => number; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/object.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'assign': Function; 'assignIn': Function; 'assignInWith': Function; 'assignWith': Function; 'at': Function; 'create': (prototype: any, properties?: any) => any; 'defaults': Function; 'defaultsDeep': Function; ... 38 more ...; 'valuesIn': (object: any) => any[]; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/seq.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'at': Function; 'chain': (value: any) => any; 'commit': () => any; 'lodash': typeof lodash; 'next': typeof wrapperNext; 'plant': (value: any) => any; 'reverse': () => any; 'tap': (value: any, interceptor: Function) => any; ... 5 more ...; 'wrapperChain': () => any; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/string.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'camelCase': Function; 'capitalize': (string?: string | undefined) => string; 'deburr': (string?: string | undefined) => string; 'endsWith': (string?: string | undefined, target?: string | undefined, position?: number | undefined) => boolean; ... 26 more ...; 'words': (string?: string | undefined...' is not assignable to parameter of type 'string'.
node_modules/lodash/fp/util.js(2,26): error TS2345: Argument of type '{ [x: string]: any; 'attempt': Function; 'bindAll': Function; 'cond': (pairs: any[]) => Function; 'conforms': (source: any) => Function; 'constant': (value: any) => Function; 'defaultTo': (value: any, defaultValue: any) => any; ... 25 more ...; 'uniqueId': (prefix?: string | undefined) => string; }' is not assignable to parameter of type 'string'.
node_modules/lodash/fp.js(2,18): error TS2554: Expected 3-4 arguments, but got 2.
node_modules/lodash/includes.js(24,10): error TS1003: Identifier expected.
node_modules/lodash/includes.js(24,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
@@ -360,9 +360,9 @@ node_modules/lodash/pickBy.js(33,12): error TS2722: Cannot invoke an object whic
node_modules/lodash/property.js(29,37): error TS2345: Argument of type 'string | symbol' is not assignable to parameter of type 'string'.
Type 'symbol' is not assignable to type 'string'.
node_modules/lodash/pullAllBy.js(29,34): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/reduce.js(48,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function, accumulator?: any, initAccum?: boolean | undefin...' has no compatible call signatures.
node_modules/lodash/reduce.js(48,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function, accumulator?: any, initAccum?: boolean | undefined) => any) | ((collection: any, iteratee: Function, accumulator: any, initAccum: boolean, eachFunc: Function) => any)' has no compatible call signatures.
node_modules/lodash/reduce.js(48,27): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/reduceRight.js(33,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function, accumulator?: any, initAccum?: boolean | undefin...' has no compatible call signatures.
node_modules/lodash/reduceRight.js(33,10): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function, accumulator?: any, initAccum?: boolean | undefined) => any) | ((collection: any, iteratee: Function, accumulator: any, initAccum: boolean, eachFunc: Function) => any)' has no compatible call signatures.
node_modules/lodash/reduceRight.js(33,27): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/reject.js(43,34): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/remove.js(41,15): error TS2554: Expected 0-1 arguments, but got 2.
@@ -407,7 +407,7 @@ node_modules/lodash/throttle.js(62,31): error TS2345: Argument of type '{ 'leadi
node_modules/lodash/toLower.js(11,21): error TS8024: JSDoc '@param' tag has name 'string', but there is no parameter with that name.
node_modules/lodash/toUpper.js(11,21): error TS8024: JSDoc '@param' tag has name 'string', but there is no parameter with that name.
node_modules/lodash/transform.js(46,14): error TS2554: Expected 0-1 arguments, but got 2.
node_modules/lodash/transform.js(59,3): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function) => any[]) | ((object: any, iteratee: Function) =...' has no compatible call signatures.
node_modules/lodash/transform.js(59,3): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((array?: any[] | undefined, iteratee: Function) => any[]) | ((object: any, iteratee: Function) => any)' has no compatible call signatures.
node_modules/lodash/transform.js(60,12): error TS2722: Cannot invoke an object which is possibly 'undefined'.
node_modules/lodash/trim.js(20,10): error TS1003: Identifier expected.
node_modules/lodash/trim.js(20,10): error TS8024: JSDoc '@param' tag has name '', but there is no parameter with that name.
+12 -12
View File
@@ -1,7 +1,7 @@
Exit Code: 1
Standard output:
node_modules/npm/bin/npm-cli.js(6,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Echo'?
node_modules/npm/bin/npm-cli.js(13,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Quit'?
node_modules/npm/bin/npm-cli.js(6,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: number; Item(n: number): string; }; ScriptFullName: string; Quit(exitCode?: number | undefined): number; ... 12 more ...; Sleep(intTime: number): void; }'. Did you mean 'Echo'?
node_modules/npm/bin/npm-cli.js(13,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: number; Item(n: number): string; }; ScriptFullName: string; Quit(exitCode?: number | undefined): number; ... 12 more ...; Sleep(intTime: number): void; }'. Did you mean 'Quit'?
node_modules/npm/bin/npm-cli.js(47,7): error TS2339: Property 'argv' does not exist on type 'EventEmitter'.
node_modules/npm/bin/npm-cli.js(48,11): error TS2339: Property 'deref' does not exist on type 'EventEmitter'.
node_modules/npm/bin/npm-cli.js(48,21): error TS2339: Property 'argv' does not exist on type 'EventEmitter'.
@@ -492,11 +492,11 @@ node_modules/npm/lib/ls.js(152,11): error TS2339: Property 'config' does not exi
node_modules/npm/lib/ls.js(180,22): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(191,52): error TS2339: Property 'globalDir' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(254,22): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(260,16): error TS2339: Property 'problems' does not exist on type 'string | { [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid...'.
node_modules/npm/lib/ls.js(260,16): error TS2339: Property 'problems' does not exist on type 'string | { [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid: boolean; from: any; resolved: any; peerInvalid: boolean; dependencies: {}; } | { [x: string]: any; required: any; missing: boolean; } | { ...; }'.
Property 'problems' does not exist on type 'string'.
node_modules/npm/lib/ls.js(262,54): error TS2339: Property 'problems' does not exist on type 'string | { [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid...'.
node_modules/npm/lib/ls.js(262,54): error TS2339: Property 'problems' does not exist on type 'string | { [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid: boolean; from: any; resolved: any; peerInvalid: boolean; dependencies: {}; } | { [x: string]: any; required: any; missing: boolean; } | { ...; }'.
Property 'problems' does not exist on type 'string'.
node_modules/npm/lib/ls.js(264,12): error TS2538: Type '{ [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid: boolean...' cannot be used as an index type.
node_modules/npm/lib/ls.js(264,12): error TS2538: Type '{ [x: string]: any; name: any; version: any; extraneous: boolean; problems: any; invalid: boolean; from: any; resolved: any; peerInvalid: boolean; dependencies: {}; }' cannot be used as an index type.
node_modules/npm/lib/ls.js(357,40): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(362,26): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(365,15): error TS2339: Property 'color' does not exist on type 'EventEmitter'.
@@ -515,8 +515,8 @@ node_modules/npm/lib/ls.js(522,18): error TS2339: Property 'config' does not exi
node_modules/npm/lib/ls.js(528,19): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(538,12): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/ls.js(544,56): error TS2339: Property 'globalDir' does not exist on type 'EventEmitter'.
node_modules/npm/lib/npm.js(5,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Echo'?
node_modules/npm/lib/npm.js(12,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: nu...'. Did you mean 'Quit'?
node_modules/npm/lib/npm.js(5,13): error TS2551: Property 'echo' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: number; Item(n: number): string; }; ScriptFullName: string; Quit(exitCode?: number | undefined): number; ... 12 more ...; Sleep(intTime: number): void; }'. Did you mean 'Echo'?
node_modules/npm/lib/npm.js(12,13): error TS2551: Property 'quit' does not exist on type '{ Echo(s: any): void; StdErr: TextStreamWriter; StdOut: TextStreamWriter; Arguments: { length: number; Item(n: number): string; }; ScriptFullName: string; Quit(exitCode?: number | undefined): number; ... 12 more ...; Sleep(intTime: number): void; }'. Did you mean 'Quit'?
node_modules/npm/lib/npm.js(30,14): error TS2345: Argument of type '"log"' is not assignable to parameter of type 'Signals'.
node_modules/npm/lib/npm.js(58,7): error TS2339: Property 'config' does not exist on type 'EventEmitter'.
node_modules/npm/lib/npm.js(68,7): error TS2339: Property 'commands' does not exist on type 'EventEmitter'.
@@ -800,7 +800,7 @@ node_modules/npm/lib/utils/error-handler.js(146,27): error TS2339: Property 'con
node_modules/npm/lib/utils/error-handler.js(166,14): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/npm/lib/utils/error-handler.js(167,16): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/npm/lib/utils/error-handler.js(168,8): error TS2339: Property 'code' does not exist on type 'Error'.
node_modules/npm/lib/utils/error-handler.js(186,40): error TS2345: Argument of type '{ (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number...' is not assignable to parameter of type '(value: string, index: number, array: string[]) => string'.
node_modules/npm/lib/utils/error-handler.js(186,40): error TS2345: Argument of type '{ (value: any, replacer?: ((key: string, value: any) => any) | undefined, space?: string | number | undefined): string; (value: any, replacer?: (string | number)[] | null | undefined, space?: string | ... 1 more ... | undefined): string; }' is not assignable to parameter of type '(value: string, index: number, array: string[]) => string'.
Types of parameters 'replacer' and 'index' are incompatible.
Type 'number' is not assignable to type '((key: string, value: any) => any) | undefined'.
node_modules/npm/lib/utils/error-handler.js(188,33): error TS2339: Property 'version' does not exist on type 'EventEmitter'.
@@ -1253,8 +1253,8 @@ node_modules/npm/test/tap/init-interrupt.js(8,29): error TS2307: Cannot find mod
node_modules/npm/test/tap/init-interrupt.js(28,7): error TS2339: Property 'load' does not exist on type 'EventEmitter'.
node_modules/npm/test/tap/install-actions.js(4,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-actions.js(13,7): error TS2339: Property 'load' does not exist on type 'EventEmitter'.
node_modules/npm/test/tap/install-actions.js(108,27): error TS2345: Argument of type '{ [x: string]: any; path: string; package: { [x: string]: any; dependencies: { [x: string]: any; ...' is not assignable to parameter of type '{ [x: string]: any; name: string; path: string; package: { [x: string]: any; scripts: { [x: strin...'.
Property 'name' is missing in type '{ [x: string]: any; path: string; package: { [x: string]: any; dependencies: { [x: string]: any; ...'.
node_modules/npm/test/tap/install-actions.js(108,27): error TS2345: Argument of type '{ [x: string]: any; path: string; package: { [x: string]: any; dependencies: { [x: string]: any; b: string; }; optionalDependencies: { [x: string]: any; a: string; }; }; children: ({ [x: string]: any; name: string; path: string; package: { [x: string]: any; scripts: { ...; }; dependencies: { ...; }; }; isTop: boolea...' is not assignable to parameter of type '{ [x: string]: any; name: string; path: string; package: { [x: string]: any; scripts: { [x: string]: any; postinstall: string; }; dependencies: { [x: string]: any; b: string; }; }; isTop: boolean; }'.
Property 'name' is missing in type '{ [x: string]: any; path: string; package: { [x: string]: any; dependencies: { [x: string]: any; b: string; }; optionalDependencies: { [x: string]: any; a: string; }; }; children: ({ [x: string]: any; name: string; path: string; package: { [x: string]: any; scripts: { ...; }; dependencies: { ...; }; }; isTop: boolea...'.
node_modules/npm/test/tap/install-at-locally.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-bad-dep-format.js(7,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/install-bad-man.js(7,20): error TS2307: Cannot find module 'tap'.
@@ -1653,8 +1653,8 @@ node_modules/npm/test/tap/unit-deps-earliestInstallable.js(3,29): error TS2307:
node_modules/npm/test/tap/unit-deps-removeObsoleteDep.js(2,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/unit-deps-removeObsoleteDep.js(3,29): error TS2307: Cannot find module 'require-inject'.
node_modules/npm/test/tap/unit-deps-removeObsoleteDep.js(32,26): error TS2345: Argument of type '{ [x: string]: any; requires: { [x: string]: any; requiredBy: never[]; }[]; }' is not assignable to parameter of type 'never'.
node_modules/npm/test/tap/unit-deps-removeObsoleteDep.js(40,26): error TS2345: Argument of type '{ [x: string]: any; requires: { [x: string]: any; requiredBy: { [x: string]: any; isTop: boolean;...' is not assignable to parameter of type '{ [x: string]: any; isTop: boolean; }'.
Property 'isTop' is missing in type '{ [x: string]: any; requires: { [x: string]: any; requiredBy: { [x: string]: any; isTop: boolean;...'.
node_modules/npm/test/tap/unit-deps-removeObsoleteDep.js(40,26): error TS2345: Argument of type '{ [x: string]: any; requires: { [x: string]: any; requiredBy: { [x: string]: any; isTop: boolean; }[]; }[]; }' is not assignable to parameter of type '{ [x: string]: any; isTop: boolean; }'.
Property 'isTop' is missing in type '{ [x: string]: any; requires: { [x: string]: any; requiredBy: { [x: string]: any; isTop: boolean; }[]; }[]; }'.
node_modules/npm/test/tap/unit-deps-replaceModule.js(2,20): error TS2307: Cannot find module 'tap'.
node_modules/npm/test/tap/unit-deps-replaceModule.js(6,7): error TS2339: Property 'load' does not exist on type 'EventEmitter'.
node_modules/npm/test/tap/unit-module-name.js(2,20): error TS2307: Cannot find module 'tap'.
+23 -23
View File
@@ -22,18 +22,18 @@ src/language-css/parser-postcss.js(100,30): error TS2345: Argument of type 'any'
src/language-css/parser-postcss.js(104,28): error TS2345: Argument of type '{ [x: string]: any; groups: never[]; type: string; }' is not assignable to parameter of type 'never'.
src/language-css/parser-postcss.js(407,32): error TS2531: Object is possibly 'null'.
src/language-css/printer-postcss.js(3,30): error TS2307: Cannot find module 'html-tag-names'.
src/language-handlebars/parser-glimmer.js(27,26): error TS2345: Argument of type '{ plugins: { ast: (() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): voi...' is not assignable to parameter of type 'PreprocessOptions'.
src/language-handlebars/parser-glimmer.js(27,26): error TS2345: Argument of type '{ plugins: { ast: (() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; })[]; }; }' is not assignable to parameter of type 'PreprocessOptions'.
Types of property 'plugins' are incompatible.
Type '{ ast: (() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementN...' is not assignable to type '{ ast?: ASTPluginBuilder[] | undefined; }'.
Type '{ ast: (() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; })[]; }' is not assignable to type '{ ast?: ASTPluginBuilder[] | undefined; }'.
Types of property 'ast' are incompatible.
Type '(() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(nod...' is not assignable to type 'ASTPluginBuilder[]'.
Type '() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node...' is not assignable to type 'ASTPluginBuilder'.
Type '{ [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any)...' is not assignable to type 'ASTPlugin'.
Property 'name' is missing in type '{ [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any)...'.
Type '(() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; })[]' is not assignable to type 'ASTPluginBuilder[]'.
Type '() => { [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; }' is not assignable to type 'ASTPluginBuilder'.
Type '{ [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; }' is not assignable to type 'ASTPlugin'.
Property 'name' is missing in type '{ [x: string]: any; visitor: { [x: string]: any; Program(node: any): void; ElementNode(node: any): void; }; }'.
src/language-handlebars/printer-glimmer.js(270,7): error TS2554: Expected 0-1 arguments, but got 2.
src/language-js/printer-estree.js(99,9): error TS2322: Type '{ [x: string]: any; type: string; }' is not assignable to type '{ [x: string]: any; type: string; parts: any; }'.
Property 'parts' is missing in type '{ [x: string]: any; type: string; }'.
src/language-js/printer-estree.js(302,9): error TS2345: Argument of type '{ [x: string]: any; type: string; parts: any; } | { [x: string]: any; type: string; contents: any...' is not assignable to parameter of type 'ConcatArray<never>'.
src/language-js/printer-estree.js(302,9): error TS2345: Argument of type '{ [x: string]: any; type: string; parts: any; } | { [x: string]: any; type: string; contents: any; }' is not assignable to parameter of type 'ConcatArray<never>'.
Type '{ [x: string]: any; type: string; parts: any; }' is not assignable to type 'ConcatArray<never>'.
Property 'length' is missing in type '{ [x: string]: any; type: string; parts: any; }'.
src/language-js/printer-estree.js(1224,28): error TS2345: Argument of type '{ [x: string]: any; type: string; parts: any; }' is not assignable to parameter of type 'string | ConcatArray<string>'.
@@ -46,7 +46,7 @@ src/language-js/printer-estree.js(1605,18): error TS2345: Argument of type '"whi
src/language-js/printer-estree.js(1614,9): error TS2345: Argument of type '")"' is not assignable to parameter of type '{ [x: string]: any; type: string; contents: any; break: boolean; expandedStates: any; }'.
src/language-js/printer-estree.js(3293,23): error TS2532: Object is possibly 'undefined'.
src/language-js/printer-estree.js(3294,24): error TS2532: Object is possibly 'undefined'.
src/language-js/printer-estree.js(3647,5): error TS2345: Argument of type '"" | { [x: string]: any; type: string; parts: any; } | { [x: string]: any; type: string; contents...' is not assignable to parameter of type 'string'.
src/language-js/printer-estree.js(3647,5): error TS2345: Argument of type '"" | { [x: string]: any; type: string; parts: any; } | { [x: string]: any; type: string; contents: any; }' is not assignable to parameter of type 'string'.
Type '{ [x: string]: any; type: string; parts: any; }' is not assignable to type 'string'.
src/language-js/printer-estree.js(3651,16): error TS2345: Argument of type '{ [x: string]: any; type: string; parts: any; }' is not assignable to parameter of type 'string'.
src/language-js/printer-estree.js(3693,9): error TS2345: Argument of type '{ [x: string]: any; type: string; parts: any; }' is not assignable to parameter of type 'string'.
@@ -67,29 +67,29 @@ src/language-vue/parser-vue.js(54,23): error TS2345: Argument of type '(m: strin
src/language-vue/parser-vue.js(180,34): error TS2339: Property 'toLowerCase' does not exist on type 'never'.
src/language-vue/parser-vue.js(244,26): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.
src/language-vue/parser-vue.js(393,25): error TS2345: Argument of type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to parameter of type 'never'.
src/language-vue/parser-vue.js(398,23): error TS2345: Argument of type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to parameter of type '{ [x: string]: any; tag: string; attrs: never[]; unary: boolean; start: number; contentStart: num...'.
src/language-vue/parser-vue.js(398,23): error TS2345: Argument of type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to parameter of type '{ [x: string]: any; tag: string; attrs: never[]; unary: boolean; start: number; contentStart: number; contentEnd: any; end: any; children: never[]; comments: never[]; }'.
Property 'contentStart' is missing in type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }'.
src/language-vue/parser-vue.js(399,9): error TS2322: Type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to type '{ [x: string]: any; tag: string; attrs: never[]; unary: boolean; start: number; contentStart: num...'.
src/language-vue/parser-vue.js(399,9): error TS2322: Type '{ [x: string]: any; tag: any; attrs: any; unary: any; start: any; children: never[]; }' is not assignable to type '{ [x: string]: any; tag: string; attrs: never[]; unary: boolean; start: number; contentStart: number; contentEnd: any; end: any; children: never[]; comments: never[]; }'.
src/main/core-options.js(51,43): error TS1005: '}' expected.
src/main/core-options.js(63,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: num...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(63,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: number; step: number; }; description: any; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'.
src/main/core-options.js(69,5): error TS2322: Type 'undefined' is not assignable to type 'string | number | boolean | { since: string; value: string | number | boolean; }[] | [{ value: (s...'.
src/main/core-options.js(82,5): error TS2322: Type '{ since: string; category: string; type: "boolean"; default: false; description: string; cliCateg...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(69,5): error TS2322: Type 'undefined' is not assignable to type 'string | number | boolean | { since: string; value: string | number | boolean; }[] | [{ value: (string | number | boolean)[]; }]'.
src/main/core-options.js(82,5): error TS2322: Type '{ since: string; category: string; type: "boolean"; default: false; description: string; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'.
src/main/core-options.js(92,5): error TS2322: Type '({ [x: string]: any; value: string; description: string; } | { [x: string]: any; value: string; s...' is not assignable to type 'OptionChoiceInfo'.
Property 'value' is missing in type '({ [x: string]: any; value: string; description: string; } | { [x: string]: any; value: string; s...'.
src/main/core-options.js(122,5): error TS2322: Type '{ since: string; type: "path"; array: true; default: [{ value: never[]; }]; category: string; des...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(92,5): error TS2322: Type '({ [x: string]: any; value: string; description: string; } | { [x: string]: any; value: string; since: string; description: string; } | { [x: string]: any; value: string; since: string; description: string; deprecated: string; redirect: string; })[]' is not assignable to type 'OptionChoiceInfo'.
Property 'value' is missing in type '({ [x: string]: any; value: string; description: string; } | { [x: string]: any; value: string; since: string; description: string; } | { [x: string]: any; value: string; since: string; description: string; deprecated: string; redirect: string; })[]'.
src/main/core-options.js(122,5): error TS2322: Type '{ since: string; type: "path"; array: true; default: [{ value: never[]; }]; category: string; description: string; exception: (value: any) => boolean; cliName: string; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliName' does not exist in type 'OptionInfo'.
src/main/core-options.js(125,3): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; description: string; range: { st...' is not assignable to type 'OptionInfo'.
Property 'array' is missing in type '{ since: string; category: string; type: "int"; default: number; description: string; range: { st...'.
src/main/core-options.js(144,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: num...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(125,3): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; description: string; range: { start: number; end: number; step: number; }; }' is not assignable to type 'OptionInfo'.
Property 'array' is missing in type '{ since: string; category: string; type: "int"; default: number; description: string; range: { start: number; end: number; step: number; }; }'.
src/main/core-options.js(144,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: number; step: number; }; description: any; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'.
src/main/core-options.js(157,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: num...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(157,5): error TS2322: Type '{ since: string; category: string; type: "int"; default: number; range: { start: number; end: number; step: number; }; description: any; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'.
src/main/core-options.js(168,5): error TS2322: Type '{ since: string; category: string; type: "boolean"; default: false; description: any; cliCategory...' is not assignable to type 'OptionInfo'.
src/main/core-options.js(168,5): error TS2322: Type '{ since: string; category: string; type: "boolean"; default: false; description: any; cliCategory: string; }' is not assignable to type 'OptionInfo'.
Object literal may only specify known properties, and 'cliCategory' does not exist in type 'OptionInfo'.
src/main/core-options.js(170,3): error TS2322: Type '{ type: "int"; category: string; default: number; description: string; range: { start: number; en...' is not assignable to type 'OptionInfo'.
Property 'since' is missing in type '{ type: "int"; category: string; default: number; description: string; range: { start: number; en...'.
src/main/core-options.js(170,3): error TS2322: Type '{ type: "int"; category: string; default: number; description: string; range: { start: number; end: number; step: number; }; }' is not assignable to type 'OptionInfo'.
Property 'since' is missing in type '{ type: "int"; category: string; default: number; description: string; range: { start: number; end: number; step: number; }; }'.
src/main/core-options.js(182,5): error TS2322: Type 'string' is not assignable to type 'boolean | null'.
src/main/core-options.js(187,3): error TS2322: Type '{ since: string; category: string; type: "boolean"; default: false; description: string; }' is not assignable to type 'OptionInfo'.
Property 'array' is missing in type '{ since: string; category: string; type: "boolean"; default: false; description: string; }'.
+31 -31
View File
@@ -2,41 +2,41 @@ Exit Code: 1
Standard output:
node_modules/uglify-js/lib/ast.js(209,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/ast.js(331,33): error TS2339: Property 'transform' does not exist on type 'string'.
node_modules/uglify-js/lib/ast.js(872,5): error TS2322: Type '{ [x: string]: any; _visit: (node: any, descend: any) => any; parent: (n: any) => any; push: type...' is not assignable to type 'TreeWalker'.
node_modules/uglify-js/lib/ast.js(872,5): error TS2322: Type '{ [x: string]: any; _visit: (node: any, descend: any) => any; parent: (n: any) => any; push: typeof push; pop: typeof pop; self: () => any; find_parent: (type: any) => any; has_directive: (type: any) => any; loopcontrol_target: (node: any) => any; in_boolean_context: () => boolean | undefined; }' is not assignable to type 'TreeWalker'.
Object literal may only specify known properties, but '_visit' does not exist in type 'TreeWalker'. Did you mean to write 'visit'?
node_modules/uglify-js/lib/compress.js(166,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(503,26): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(820,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1075,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1089,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures.
node_modules/uglify-js/lib/compress.js(1153,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1195,112): error TS2532: Object is possibly 'undefined'.
node_modules/uglify-js/lib/compress.js(1196,29): error TS2532: Object is possibly 'undefined'.
node_modules/uglify-js/lib/compress.js(1205,87): error TS2322: Type 'false' is not assignable to type 'number'.
node_modules/uglify-js/lib/compress.js(1213,29): error TS2322: Type 'false' is not assignable to type 'never'.
node_modules/uglify-js/lib/compress.js(1316,38): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1411,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1507,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1539,26): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1953,44): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(2145,19): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(2464,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3204,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3217,33): error TS2322: Type '"f"' is not assignable to type 'boolean'.
node_modules/uglify-js/lib/compress.js(3356,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3411,14): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3420,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3678,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3699,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3709,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3868,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { [x: string]: any; set: (key: any, val: any) => any; add: (key: any, val: any) => a...', but here has type 'any'.
node_modules/uglify-js/lib/compress.js(3920,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
node_modules/uglify-js/lib/compress.js(3945,30): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(500,26): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(817,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1072,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1086,51): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'true | ((node: any) => any)' has no compatible call signatures.
node_modules/uglify-js/lib/compress.js(1150,53): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1192,112): error TS2532: Object is possibly 'undefined'.
node_modules/uglify-js/lib/compress.js(1193,29): error TS2532: Object is possibly 'undefined'.
node_modules/uglify-js/lib/compress.js(1202,87): error TS2322: Type 'false' is not assignable to type 'number'.
node_modules/uglify-js/lib/compress.js(1210,29): error TS2322: Type 'false' is not assignable to type 'never'.
node_modules/uglify-js/lib/compress.js(1313,38): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1408,38): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(1504,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1536,26): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(1950,44): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(2142,19): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(2461,27): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3201,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3214,33): error TS2322: Type '"f"' is not assignable to type 'boolean'.
node_modules/uglify-js/lib/compress.js(3353,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3408,14): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3417,29): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3676,23): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(3697,24): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3707,28): error TS2339: Property 'parent' does not exist on type 'TreeTransformer'.
node_modules/uglify-js/lib/compress.js(3866,21): error TS2403: Subsequent variable declarations must have the same type. Variable 'defs' must be of type 'Dictionary & { [x: string]: any; set: (key: any, val: any) => any; add: (key: any, val: any) => any; get: (key: any) => any; del: (key: any) => any; has: (key: any) => boolean; each: (f: any) => void; size: () => any; map: (f: any) => any[]; clone: () => Dictionary & any; toObject: () => any; }', but here has type 'any'.
node_modules/uglify-js/lib/compress.js(3918,17): error TS2447: The '|=' operator is not allowed for boolean types. Consider using '||' instead.
node_modules/uglify-js/lib/compress.js(3974,30): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(4083,18): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(4382,17): error TS2403: Subsequent variable declarations must have the same type. Variable 'body' must be of type 'any[]', but here has type 'any'.
node_modules/uglify-js/lib/compress.js(4466,22): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(4816,30): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/compress.js(4823,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ [x: string]: any; get: () => string; toString: () => string; indent: () => void; indentation: (...'.
node_modules/uglify-js/lib/compress.js(4823,25): error TS2403: Subsequent variable declarations must have the same type. Variable 'code' must be of type 'string', but here has type '{ [x: string]: any; get: () => string; toString: () => string; indent: () => void; indentation: () => number; current_width: () => number; should_break: () => boolean; has_parens: () => boolean; newline: () => void; print: (str: any) => void; ... 24 more ...; parent: (n: any) => any; }'.
node_modules/uglify-js/lib/compress.js(4827,36): error TS2532: Object is possibly 'undefined'.
node_modules/uglify-js/lib/compress.js(4832,41): error TS2339: Property 'get' does not exist on type 'string'.
node_modules/uglify-js/lib/compress.js(5319,18): error TS2454: Variable 'is_strict_comparison' is used before being assigned.
@@ -82,9 +82,9 @@ node_modules/uglify-js/lib/parse.js(1430,20): error TS2531: Object is possibly '
node_modules/uglify-js/lib/parse.js(1516,48): error TS2531: Object is possibly 'null'.
node_modules/uglify-js/lib/parse.js(1542,35): error TS2531: Object is possibly 'null'.
node_modules/uglify-js/lib/parse.js(1587,52): error TS2531: Object is possibly 'null'.
node_modules/uglify-js/lib/propmangle.js(61,18): error TS2339: Property 'prototype' does not exist on type 'ObjectConstructor | FunctionConstructor | StringConstructor | BooleanConstructor | NumberConstruc...'.
node_modules/uglify-js/lib/propmangle.js(61,18): error TS2339: Property 'prototype' does not exist on type 'ObjectConstructor | FunctionConstructor | StringConstructor | BooleanConstructor | NumberConstructor | Math | DateConstructor | RegExpConstructor | ErrorConstructor | ArrayConstructor'.
Property 'prototype' does not exist on type 'Math'.
node_modules/uglify-js/lib/propmangle.js(62,45): error TS2339: Property 'prototype' does not exist on type 'ObjectConstructor | FunctionConstructor | StringConstructor | BooleanConstructor | NumberConstruc...'.
node_modules/uglify-js/lib/propmangle.js(62,45): error TS2339: Property 'prototype' does not exist on type 'ObjectConstructor | FunctionConstructor | StringConstructor | BooleanConstructor | NumberConstructor | Math | DateConstructor | RegExpConstructor | ErrorConstructor | ArrayConstructor'.
Property 'prototype' does not exist on type 'Math'.
node_modules/uglify-js/lib/propmangle.js(75,14): error TS2554: Expected 0 arguments, but got 1.
node_modules/uglify-js/lib/propmangle.js(85,15): error TS2554: Expected 0 arguments, but got 1.
@@ -1,4 +1,5 @@
function test(p: any) {
'use strict';
'use strong';
p = { prop: p } = p;
}
@@ -0,0 +1,14 @@
declare function f1(a: number);
declare function f1(a: number, b: number, c: number);
f1();
f1(1, 2);
f1(1, 2, 3, 4);
declare function f2();
declare function f2(a: number, b: number);
declare function f2(a: number, b: number, c: number, d: number);
declare function f2(a: number, b: number, c: number, d: number, e: number, f: number);
f2(1);
f2(1, 2, 3);
f2(1, 2, 3, 4, 5);
f2(1, 2, 3, 4, 5, 6, 7);
@@ -16,3 +16,23 @@ function i(x) { return x }
var j = x => x
/** @type {{ (x: number): string }} */
var k = function (x) { return x }
/** @typedef {(x: 'hi' | 'bye') => 0 | 1 | 2} Argle */
/** @type {Argle} */
function blargle(s) {
return 0;
}
/** @type {0 | 1 | 2} - assignment should not error */
var zeroonetwo = blargle('hi')
/** @typedef {{(s: string): 0 | 1; (b: boolean): 2 | 3 }} Gioconda */
/** @type {Gioconda} */
function monaLisa(sb) {
return typeof sb === 'string' ? 1 : 2;
}
/** @type {2 | 3} - overloads are not supported, so there will be an error */
var twothree = monaLisa(false);
@@ -0,0 +1,13 @@
// @checkJs: true
// @allowJs: true
// @noEmit: true
// @Filename: test.js
/** @type {number} */
function f() {
return 1
}
/** @type {{ prop: string }} */
var g = function (prop) {
}
@@ -0,0 +1,10 @@
type Something<T> = { test: string } & (T extends object ? {
arg: T
} : {
arg?: undefined
});
function testFunc2<A extends object>(a: A, sa: Something<A>) {
sa = { test: 'hi', arg: a }; // not excess (but currently still not assignable)
sa = { test: 'bye', arg: a, arr: a } // excess
}
@@ -28,7 +28,7 @@ edit.deleteAtCaret('constructor(val: T) { }'.length);
verify.quickInfos({
Asig: "constructor A<string>(): A<string>",
Bsig: "constructor B<string>(val: string): B<string>",
Csig: "constructor C<T>(): C<T>", // Cannot resolve signature
Csig: "constructor C<{}>(): C<{}>", // Cannot resolve signature
Dsig: "constructor D<string>(val: string): D<string>" // Cannot resolve signature
});
@@ -37,6 +37,6 @@ edit.deleteAtCaret("val: T".length);
verify.quickInfos({
Asig: "constructor A<string>(): A<string>",
Bsig: "constructor B<string>(val: string): B<string>",
Csig: "constructor C<T>(): C<T>", // Cannot resolve signature
Csig: "constructor C<{}>(): C<{}>", // Cannot resolve signature
Dsig: "constructor D<string>(): D<string>"
});
@@ -10,17 +10,21 @@
////import * as abs from "abs";
////abs;
// @Filename: /b.ts
////const x: import("abs").T = 0;
test.setTypesRegistry({
"abs": undefined,
});
goTo.file("/a.ts");
verify.codeFixAvailable([{
description: "Install '@types/abs'",
commands: [{
type: "install package",
file: "/a.ts",
packageName: "@types/abs",
}],
}]);
for (const file of ["/a.ts", "/b.ts"]) {
goTo.file(file);
verify.codeFixAvailable([{
description: "Install '@types/abs'",
commands: [{
type: "install package",
file,
packageName: "@types/abs",
}],
}]);
}
@@ -0,0 +1,63 @@
/// <reference path='fourslash.ts' />
// @allowJs: true
// @Filename: /a.js
/////** @template T Parameter doc comment */
////function f() {}
////
/////**
//// * Doc
//// * @template T Comment
//// */
////function g() {}
////
/////**
//// * Doc
//// * @template T Comment
//// * @template U Comment
//// */
////function h() {}
////
/////** @template T Comment @return {void} */
////function i() {}
////
/////**
////Doc
////@template T comment
////@template U comment
////@param {number} x
////*/
////function j(x) { return x; }
verify.codeFixAll({
fixId: "unusedIdentifier_delete",
fixAllDescription: "Delete all unused declarations",
newFileContent:
`
function f() {}
/**
* Doc
* Comment
*/
function g() {}
/**
* Doc
* Comment
* Comment
*/
function h() {}
/** Comment @return {void} */
function i() {}
/**
Doc
comment
comment
@param {number} x
*/
function j(x) { return x; }`,
});
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////interface A { a: number }
////interface B { b: number }
////declare function f(a: A): void;
////declare function f(b: B): void;
////f({ /**/ });
verify.completions({ marker: "", exact: ["a", "b"] });
@@ -0,0 +1,15 @@
/// <reference path="fourslash.ts" />
////interface A { a: number }
////interface B { b: number }
////interface C { c: number }
////declare function f(a: A): void;
////declare function f(...bs: B[]): void;
////declare function f(...cs: C[]): void;
////f({ /*1*/ });
////f({ a: 1 }, { /*2*/ });
verify.completions(
{ marker: "1", exact: ["a", "b", "c"] },
{ marker: "2", exact: ["b", "c"] },
);
@@ -0,0 +1,9 @@
/// <reference path="fourslash.ts" />
////interface A { a: number }
////interface B { b: number }
////declare function f(n: number): A;
////declare function f(s: string): B;
////f()./**/
verify.completions({ marker: "", exact: ["a", "b"] });
@@ -0,0 +1,38 @@
/// <reference path="fourslash.ts" />
////const x = 0;
////type T = number;
////function f(x: number) {}
////function g<T>(x: T) {}
////class C<T> {}
////x + {| "valueOnly": true |}
////x < {| "valueOnly": true |}
////f < {| "valueOnly": true |}
////g < {| "valueOnly": false |}
////const something: C<{| "valueOnly": false |};
////const something2: C<C<{| "valueOnly": false |};
////new C<{| "valueOnly": false |};
////new C<C<{| "valueOnly": false |};
////
////declare const callAndConstruct: { new<T>(): callAndConstruct<T>; <T>(): string; };
////interface callAndConstruct<T> {}
////new callAndConstruct<callAndConstruct</*callAndConstruct*/
for (const marker of test.markers()) {
if (marker.data && marker.data.valueOnly) {
verify.completions({ marker, includes: "x", excludes: "T" });
}
else {
verify.completions({ marker, includes: ["x", "T"] });
}
}
verify.signatureHelp({
marker: "callAndConstruct",
text: "callAndConstruct<T>(): string",
parameterName: "T",
parameterSpan: "T",
parameterCount: 1,
argumentCount: 1,
});
+8 -2
View File
@@ -184,7 +184,7 @@ declare namespace FourSlashInterface {
index?: number,
preferences?: UserPreferences,
});
codeFixAvailable(options?: Array<{ description: string, actions?: Array<{ type: string, data: {} }>, commands?: {}[] }>): void;
codeFixAvailable(options?: ReadonlyArray<VerifyCodeFixAvailableOptions>): void;
applicableRefactorAvailableAtMarker(markerName: string): void;
codeFixDiagnosticsAvailableAtMarkers(markerNames: string[], diagnosticCode?: number): void;
applicableRefactorAvailableForRange(): void;
@@ -200,7 +200,7 @@ declare namespace FourSlashInterface {
assertHasRanges(ranges: Range[]): void;
caretAtMarker(markerName?: string): void;
completions(...options: {
readonly marker?: ArrayOrSingle<string>,
readonly marker?: ArrayOrSingle<string | Marker>,
readonly isNewIdentifierLocation?: boolean;
readonly exact?: ArrayOrSingle<ExpectedCompletionEntry>;
readonly includes?: ArrayOrSingle<ExpectedCompletionEntry>;
@@ -604,6 +604,12 @@ declare namespace FourSlashInterface {
triggerCharacter?: string,
}
export interface VerifyCodeFixAvailableOptions {
readonly description: string;
readonly actions?: ReadonlyArray<{ readonly type: string, readonly data: {} }>;
readonly commands?: ReadonlyArray<{}?;
}
interface VerifyNavigateToOptions {
readonly pattern: string;
readonly fileName?: string;
@@ -17,10 +17,10 @@
////foo7(1, <string>(/*7*/ // signature help shows y as T
verify.signatureHelp(
{ marker: "1", text: "foo1<T>(x: number, callback: (y1: T) => number): void" },
{ marker: "1", text: "foo1(x: number, callback: (y1: {}) => number): void" },
// TODO: GH#23631
// { marker: "2", text: "foo2(x: number, callback: (y2: {}) => number): void" },
{ marker: "3", text: "foo3<T>(x: number, callback: (y3: T) => number): void" },
{ marker: "3", text: "foo3(x: number, callback: (y3: {}) => number): void" },
// TODO: GH#23631
// { marker: "4", text: "foo4(x: number, callback: (y4: string) => number): void" },
{ marker: "5", text: "foo5(x: number, callback: (y5: string) => number): void" },
@@ -31,4 +31,4 @@ goTo.marker('6');
// verify.signatureHelp({ text: "foo6(x: number, callback: (y6: {}) => number): void" });
edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests
verify.signatureHelp({ marker: "7", text: "foo7<T>(x: number, callback: (y7: T) => number): void" });
verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: {}) => number): void" });
@@ -24,9 +24,9 @@
////foo7(1, <string>(/*7*/ // signature help shows y as T
verify.signatureHelp(
{ marker: "1", text: "foo1<T>(x: number, callback: (y1: T) => number): void" },
{ marker: "2", text: "foo2<T>(x: number, callback: (y2: T) => number): void" },
{ marker: "3", text: "foo3<T>(x: number, callback: (y3: T) => number): void" },
{ marker: "1", text: "foo1(x: number, callback: (y1: {}) => number): void" },
{ marker: "2", text: "foo2(x: number, callback: (y2: {}) => number): void" },
{ marker: "3", text: "foo3(x: number, callback: (y3: {}) => number): void" },
{ marker: "4", text: "foo4(x: number, callback: (y4: string) => number): void" },
{ marker: "5", text: "foo5(x: number, callback: (y5: string) => number): void" },
);
@@ -35,4 +35,4 @@ goTo.marker('6');
verify.signatureHelp({ text: "foo6(x: number, callback: (y6: {}) => number): void" });
edit.insert('string>(null,null);'); // need to make this line parse so we can get reasonable LS answers to later tests
verify.signatureHelp({ marker: "7", text: "foo7<T>(x: number, callback: (y7: T) => number): void" })
verify.signatureHelp({ marker: "7", text: "foo7(x: number, callback: (y7: {}) => number): void" })
@@ -12,4 +12,4 @@
////fo/**/o()
goTo.marker();
verify.quickInfoIs("function foo<T>(x: T): void", "Do some foo things");
verify.quickInfoIs("function foo<any>(x: any): void", "Do some foo things");
+1 -1
View File
@@ -14,7 +14,7 @@
verify.signatureHelp({
marker: "",
text: "find<T>(l: T[], x: T): T",
text: "find(l: any[], x: any): any",
docComment: "Find an item",
tags: [
// TODO: GH#24130 (see PR #24600's commits for potential fix)
@@ -509,7 +509,7 @@
//// function f<T extends A>(s: T, x: Exclude<A, T>, y: string) {}
//// f("_499", /*3*/);
//// type Decomposed/*4*/ = {[K in A]: Foo[K]}
//// type LongTuple/*5*/ = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17.18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70];
//// type LongTuple/*5*/ = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17.18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70];
//// type DeeplyMapped/*6*/ = {[K in keyof Foo]: {[K2 in keyof Foo]: [K, K2, Foo[K], Foo[K2]]}}
goTo.marker("1");
@@ -519,7 +519,7 @@ verify.quickInfoIs(`type Less = "_1" | "_2" | "_3" | "_4" | "_5" | "_6" | "_7" |
goTo.marker("3");
verify.signatureHelp({
marker: "3",
text: `f<T extends "_0" | "_1" | "_2" | "_3" | "_4" | "_5" | "_6" | "_7" | "_8" | "_9" | "_10" | "_11" | "_12" | "_13" | "_14" | "_15" | "_16" | "_17" | "_18" | "_19" | "_20" | "_21" | "_22" | "_23" | "_24" | ... 474 more ... | "_499">(s: T, x: Exclude<"_0", T> | Exclude<"_1", T> | Exclude<"_2", T> | Exclude<"_3", T> | Exclude<"_4", T> | Exclude<"_5", T> | Exclude<"_6", T> | Exclude<"_7", T> | Exclude<...> | ... 490 more ... | Exclude<...>, y: string): void`
text: `f(s: "_0" | "_1" | "_2" | "_3" | "_4" | "_5" | "_6" | "_7" | "_8" | "_9" | "_10" | "_11" | "_12" | "_13" | "_14" | "_15" | "_16" | "_17" | "_18" | "_19" | "_20" | "_21" | "_22" | "_23" | "_24" | ... 474 more ... | "_499", x: never, y: string): void`
});
goTo.marker("4");
verify.quickInfoIs(`type Decomposed = {
@@ -0,0 +1,6 @@
/// <reference path='fourslash.ts'/>
////declare function f<T>(x: number): T;
////const x/**/ = f();
verify.quickInfoAt("", "const x: {}");
@@ -8,7 +8,7 @@
verify.signatureHelp(
{ marker: "1", text: "f(x: number, y: string): number" },
{ marker: "2", text: "f<T = boolean, U = string>(x: T, y: U): T" },
{ marker: "2", text: "f(x: {}, y: {}): {}" },
// too few -- fill in rest with {}
{ marker: "3", text: "f(x: number, y: {}): number" },
// too many -- ignore extra type arguments
@@ -9,6 +9,6 @@
verify.signatureHelp(
{ marker: "1", text: "f1(a: any): a is number" },
{ marker: "2", text: "f2<T>(a: any): a is T" },
{ marker: "2", text: "f2(a: any): a is {}" },
{ marker: "3", text: "f3(a: any, ...b: any[]): a is number", isVariadic: true },
)
@@ -9,7 +9,7 @@ goTo.marker("1");
edit.insert("(");
verify.signatureHelp({
text: "bar<U>(x: U, y: U): U",
text: "bar(x: {}, y: {}): {}",
triggerReason: {
kind: "characterTyped",
triggerCharacter: "(",