@@ -172,16 +172,16 @@ namespace ts {
172
172
}
173
173
174
174
const enum CheckMode {
175
- Normal = 0, // Normal type checking
176
- Contextual = 1 << 0, // Explicitly assigned contextual type, therefore not cacheable
177
- Inferential = 1 << 1, // Inferential typing
178
- SkipContextSensitive = 1 << 2, // Skip context sensitive function expressions
179
- SkipGenericFunctions = 1 << 3, // Skip single signature generic functions
180
- IsForSignatureHelp = 1 << 4, // Call resolution for purposes of signature help
181
- ObjectRestBindingElement = 1 << 5, // Checking a type that is going to be used to determine the type of a rest binding element
182
- // e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
183
- // we need to preserve generic types instead of substituting them for constraints
184
- IncludeOptionality = 1 << 6, // TODO: description, replace bool param with flag
175
+ Normal = 0, // Normal type checking
176
+ Contextual = 1 << 0, // Explicitly assigned contextual type, therefore not cacheable
177
+ Inferential = 1 << 1, // Inferential typing
178
+ SkipContextSensitive = 1 << 2, // Skip context sensitive function expressions
179
+ SkipGenericFunctions = 1 << 3, // Skip single signature generic functions
180
+ IsForSignatureHelp = 1 << 4, // Call resolution for purposes of signature help
181
+ ObjectRestBindingElement = 1 << 5, // Checking a type that is going to be used to determine the type of a rest binding element
182
+ // e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
183
+ // we need to preserve generic types instead of substituting them for constraints
184
+ IncludeOptionality = 1 << 6, // >> TODO: description, replace bool param with flag
185
185
}
186
186
187
187
const enum SignatureCheckMode {
@@ -24939,13 +24939,10 @@ namespace ts {
24939
24939
return !!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
24940
24940
}
24941
24941
24942
- /**
24943
- * If check mode has `CheckMode.RestBindingElement`, we skip binding pattern contextual types.
24944
- */
24945
24942
function hasContextualTypeWithNoGenericTypes(node: Node, checkMode: CheckMode | undefined) {
24946
24943
// Computing the contextual type for a child of a JSX element involves resolving the type of the
24947
24944
// element's tag name, so we exclude that here to avoid circularities.
24948
- // If check mode has `CheckMode.RestBindingElement `, we skip binding pattern contextual types,
24945
+ // If check mode has `CheckMode.ObjectRestBindingElement `, we skip binding pattern contextual types,
24949
24946
// as we want the type of a rest element to be generic when possible.
24950
24947
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) &&
24951
24948
!((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
0 commit comments