8000 Fixed excess and common property checks with `NoInfer` by Andarist · Pull Request #57673 · microsoft/TypeScript · GitHub
[go: up one dir, main page]

Skip to content

Fixed excess and common property checks with NoInfer #57673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
erase all substitution types
  • Loading branch information
Andarist committed Mar 20, 2024
commit 7ebe1e5787a3d90255371e58b0de2a428cd4f0c7
6 changes: 3 additions & 3 deletions src/compiler/checker.ts
ABD6
Original file line number Diff line number Diff line change
Expand Up @@ -23904,7 +23904,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 &&
resolved.properties.length > 0 && every(resolved.properties, p => !!(p.flags & SymbolFlags.Optional));
}
if (isNoInferType(type)) {
if (type.flags & TypeFlags.Substitution) {
return isWeakType((type as SubstitutionType).baseType);
}
if (type.flags & TypeFlags.Intersection) {
Expand Down Expand Up @@ -32629,7 +32629,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return true;
}
}
if (isNoInferType(targetType)) {
if (targetType.flags & TypeFlags.Substitution) {
return isKnownProperty((targetType as SubstitutionType).baseType, name, isComparingJsxAttributes);
}
if (targetType.flags & TypeFlags.UnionOrIntersection && isExcessPropertyCheckTarget(targetType)) {
Expand All @@ -32645,7 +32645,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function isExcessPropertyCheckTarget(type: Type): boolean {
return !!(type.flags & TypeFlags.Object && !(getObjectFlags(type) & ObjectFlags.ObjectLiteralPatternWithComputedProperties) ||
type.flags & TypeFlags.NonPrimitive ||
isNoInferType(type) && isExcessPropertyCheckTarget((type as SubstitutionType).baseType) ||
type.flags & TypeFlags.Substitution && isExcessPropertyCheckTarget((type as SubstitutionType).baseType) ||
type.flags & TypeFlags.Union && some((type as UnionType).types, isExcessPropertyCheckTarget) ||
type.flags & TypeFlags.Intersection && every((type as IntersectionType).types, isExcessPropertyCheckTarget));
}
Expand Down
0