Skip to content

Commit

Permalink
Check that base types are not never-like
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Feb 10, 2020
1 parent 7ae4a21 commit 3a1ba48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8333,8 +8333,8 @@ namespace ts {
}
// TODO: Given that we allow type parmeters here now, is this `!isGenericMappedType(type)` check really needed?
// There's no reason a `T` should be allowed while a `Readonly<T>` should not.
return !!(type.flags & (TypeFlags.Object | TypeFlags.NonPrimitive | TypeFlags.Any)) && !isGenericMappedType(type) ||
!!(type.flags & TypeFlags.Intersection) && every((<IntersectionType>type).types, isValidBaseType);
return !!(type.flags & (TypeFlags.Object | TypeFlags.NonPrimitive | TypeFlags.Any) && !isGenericMappedType(type) ||
type.flags & TypeFlags.Intersection && !isNeverLikeType(type) && every((<IntersectionType>type).types, isValidBaseType));
}

function resolveBaseTypesOfInterface(type: InterfaceType): void {
Expand Down

0 comments on commit 3a1ba48

Please sign in to comment.