@@ -7133,7 +7133,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
7133
7133
7134
7134
const assertedType = convertToInstance(getTypeOfArgumentExpectingType(node.arguments[1]).type);
7135
7135
7136
- if (!isTypeSame(assertedType, arg0TypeResult.type)) {
7136
+ if (!isTypeSame(assertedType, arg0TypeResult.type, { treatAnySameAsUnknown: true } )) {
7137
7137
addDiagnostic(
7138
7138
AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.reportGeneralTypeIssues,
7139
7139
DiagnosticRule.reportGeneralTypeIssues,
@@ -8442,11 +8442,9 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
8442
8442
const castFromType = getTypeOfArgument(argList[1]).type;
8443
8443
if (isInstantiableClass(castToType) && isClassInstance(castFromType)) {
8444
8444
if (
8445
- isTypeSame(
8446
- castToType,
8447
- ClassType.cloneAsInstantiable(castFromType),
8448
- /* ignorePseudoGeneric */ true
8449
- )
8445
+ isTypeSame(castToType, ClassType.cloneAsInstantiable(castFromType), {
8446
+ ignorePseudoGeneric: true,
8447
+ })
8450
8448
) {
8451
8449
addDiagnostic(
8452
8450
AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.reportUnnecessaryCast,
@@ -9877,7 +9875,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
9877
9875
type.strippedFirstParamType.typeArguments.forEach((typeArg, index) => {
9878
9876
if (index < typeParams.length) {
9879
9877
const typeParam = typeParams[index];
9880
- if (!isTypeSame(typeParam, typeArg, /* ignorePseudoGeneric */ true)) {
9878
+ if (!isTypeSame(typeParam, typeArg, { ignorePseudoGeneric: true } )) {
9881
9879
typeVarContext.setTypeVarType(typeParams[index], typeArg);
9882
9880
}
9883
9881
}
@@ -12128,7 +12126,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
12128
12126
if (AnalyzerNodeInfo.getFileInfo(node).diagnosticRuleSet.strictDictionaryInference || hasExpectedType) {
12129
12127
valueType = combineTypes(valueTypes);
12130
12128
} else {
12131
- valueType = areTypesSame(valueTypes, /* ignorePseudoGeneric */ true) ? valueTypes[0] : fallbackType;
12129
+ valueType = areTypesSame(valueTypes, { ignorePseudoGeneric: true } ) ? valueTypes[0] : fallbackType;
12132
12130
}
12133
12131
} else {
12134
12132
valueType = fallbackType;
@@ -12461,7 +12459,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
12461
12459
inferredEntryType = combineTypes(entryTypes, maxSubtypesForInferredType);
12462
12460
} else {
12463
12461
// Is the list or set homogeneous? If so, use stricter rules. Otherwise relax the rules.
12464
- inferredEntryType = areTypesSame(entryTypes, /* ignorePseudoGeneric */ true)
12462
+ inferredEntryType = areTypesSame(entryTypes, { ignorePseudoGeneric: true } )
12465
12463
? entryTypes[0]
12466
12464
: inferredEntryType;
12467
12465
}
@@ -20654,15 +20652,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
20654
20652
srcType.tupleTypeArguments &&
20655
20653
srcType.tupleTypeArguments.length === 1
20656
20654
) {
20657
- if (
20658
- isTypeSame(
20659
- destType,
20660
- srcType.tupleTypeArguments[0].type,
20661
- /* ignorePseudoGeneric */ undefined,
20662
- /* ignoreTypeFlags */ undefined,
20663
- recursionCount
20664
- )
20665
- ) {
20655
+ if (isTypeSame(destType, srcType.tupleTypeArguments[0].type, {}, recursionCount)) {
20666
20656
return true;
20667
20657
}
20668
20658
}
@@ -21334,15 +21324,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
21334
21324
): boolean {
21335
21325
// Start by checking for an exact match. This is needed to handle unions
21336
21326
// that contain recursive type aliases.
21337
- if (
21338
- isTypeSame(
21339
- srcType,
21340
- destType,
21341
- /* ignorePseudoGeneric */ undefined,
21342
- /* ignoreTypeFlags */ undefined,
21343
- recursionCount
21344
- )
21345
- ) {
21327
+ if (isTypeSame(srcType, destType, {}, recursionCount)) {
21346
21328
return true;
21347
21329
}
21348
21330
@@ -21382,13 +21364,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
21382
21364
remainingDestSubtypes.push(destSubtype);
21383
21365
} else {
21384
21366
const srcTypeIndex = remainingSrcSubtypes.findIndex((srcSubtype) =>
21385
- isTypeSame(
21386
- srcSubtype,
21387
- destSubtype,
21388
- /* ignorePseudoGeneric */ undefined,
21389
- /* ignoreTypeFlags */ undefined,
21390
- recursionCount
21391
- )
21367
+ isTypeSame(srcSubtype, destSubtype, {}, recursionCount)
21392
21368
);
21393
21369
if (srcTypeIndex >= 0) {
21394
21370
remainingSrcSubtypes.splice(srcTypeIndex, 1);
@@ -21790,15 +21766,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
21790
21766
function assignConditionalTypeToTypeVar(destType: TypeVarType, srcType: Type, recursionCount: number): boolean {
21791
21767
// The srcType is assignable only if all of its subtypes are assignable.
21792
21768
return !findSubtype(srcType, (srcSubtype) => {
21793
- if (
21794
- isTypeSame(
21795
- destType,
21796
- srcSubtype,
21797
- /* ignorePseudoGeneric */ true,
21798
- /* ignoreTypeFlags */ undefined,
21799
- recursionCount
21800
- )
21801
- ) {
21769
+ if (isTypeSame(destType, srcSubtype, { ignorePseudoGeneric: true }, recursionCount)) {
21802
21770
return false;
21803
21771
}
21804
21772
@@ -22855,12 +22823,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
22855
22823
// dest param spec itself, it is not assignable in this case.
22856
22824
if (
22857
22825
!srcParamSpec ||
22858
- !isTypeSame(
22859
- srcParamSpec,
22860
- destParamSpec,
22861
- /* ignorePseudoGeneric */ false,
22862
- /* ignoreTypeFlags */ true
22863
- ) ||
22826
+ !isTypeSame(srcParamSpec, destParamSpec, { ignoreTypeFlags: true }) ||
22864
22827
remainingParams.length > 0
22865
22828
) {
22866
22829
canAssign = false;
@@ -23448,15 +23411,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
23448
23411
let effectiveSrcType: Type = srcType;
23449
23412
23450
23413
if (isTypeVar(srcType)) {
23451
- if (
23452
- isTypeSame(
23453
- srcType,
23454
- destType,
23455
- /* ignorePseudoGeneric */ undefined,
23456
- /* ignoreTypeFlags */ undefined,
23457
- recursionCount
23458
- )
23459
- ) {
23414
+ if (isTypeSame(srcType, destType, {}, recursionCount)) {
23460
23415
return srcType;
23461
23416
}
23462
23417
0 commit comments