mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:34:29 -05:00
Properly check singleton labeled tuple before unwrapping (#48554)
* properly check if singleton labeled tuple has optional element * also check if labeled element is rest
This commit is contained in:
committed by
GitHub
parent
aa3c5a787c
commit
99ea99b386
@@ -15860,7 +15860,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isSingletonTupleType(node: TypeNode) {
|
||||
return isTupleTypeNode(node) && length(node.elements) === 1 && !isOptionalTypeNode(node.elements[0]) && !isRestTypeNode(node.elements[0]);
|
||||
return isTupleTypeNode(node) &&
|
||||
length(node.elements) === 1 &&
|
||||
!isOptionalTypeNode(node.elements[0]) &&
|
||||
!isRestTypeNode(node.elements[0]) &&
|
||||
!(isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user