mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 01:33:15 -05:00
Avoid creating rest elements with errorType when any is spread (#57116)
This commit is contained in:
committed by
GitHub
parent
c18c1c20dc
commit
29c0024bcf
@@ -16883,7 +16883,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
const type = elementTypes[i];
|
||||
const flags = target.elementFlags[i];
|
||||
if (flags & ElementFlags.Variadic) {
|
||||
if (type.flags & TypeFlags.InstantiableNonPrimitive || isGenericMappedType(type)) {
|
||||
if (type.flags & TypeFlags.Any) {
|
||||
addElement(type, ElementFlags.Rest, target.labeledElementDeclarations?.[i]);
|
||||
}
|
||||
else if (type.flags & TypeFlags.InstantiableNonPrimitive || isGenericMappedType(type)) {
|
||||
// Generic variadic elements stay as they are.
|
||||
addElement(type, ElementFlags.Variadic, target.labeledElementDeclarations?.[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user