File tree 2 files changed +7
-20
lines changed
2 files changed +7
-20
lines changed Original file line number Diff line number Diff line change @@ -20258,22 +20258,15 @@ namespace ts {
20258
20258
* and no required properties, call/construct signatures or index signatures
20259
20259
*/
20260
20260
function isWeakType(type: Type): boolean {
20261
- if (!(type.flags & (TypeFlags.Object | TypeFlags.Intersection))) {
20262
- return false;
20261
+ if (type.flags & TypeFlags.Object) {
20262
+ const resolved = resolveStructuredTypeMembers(type as ObjectType);
20263
+ return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 &&
20264
+ resolved.properties.length > 0 && every(resolved.properties, p => !!(p.flags & SymbolFlags.Optional));
20263
20265
}
20264
- if (!((type as ObjectType | IntersectionType).objectFlags & ObjectFlags.IsWeakTypeComputed)) {
20265
- let isWeak;
20266
- if (type.flags & TypeFlags.Object) {
20267
- const resolved = resolveStructuredTypeMembers(type as ObjectType);
20268
- isWeak = resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 &&
20269
- resolved.properties.length > 0 && every(resolved.properties, p => !!(p.flags & SymbolFlags.Optional));
20270
- }
20271
- else {
20272
- isWeak = every((type as IntersectionType).types, isWeakType);
20273
- }
20274
- (type as ObjectType | IntersectionType).objectFlags |= ObjectFlags.IsWeakTypeComputed | (isWeak ? ObjectFlags.IsWeakType : 0);
20266
+ if (type.flags & TypeFlags.Intersection) {
20267
+ return every((type as IntersectionType).types, isWeakType);
20275
20268
}
20276
- return !!((type as ObjectType | IntersectionType).objectFlags & ObjectFlags.IsWeakType) ;
20269
+ return false ;
20277
20270
}
20278
20271
20279
20272
function hasCommonProperties(source: Type, target: Type, isComparingJsxAttributes: boolean) {
Original file line number Diff line number Diff line change @@ -5360,12 +5360,6 @@ namespace ts {
5360
5360
IsNeverIntersectionComputed = 1 << 25 , // IsNeverLike flag has been computed
5361
5361
/* @internal */
5362
5362
IsNeverIntersection = 1 << 26 , // Intersection reduces to never
5363
-
5364
- // Flags that require TypeFlags.Object or TypeFlags.Intersection
5365
- /* @internal */
5366
- IsWeakTypeComputed = 1 << 27 ,
5367
- /* @internal */
5368
- IsWeakType = 1 << 28 ,
5369
5363
}
5370
5364
5371
5365
/* @internal */
You can’t perform that action at this time.
0 commit comments