mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Don't include private/protected properties in keyof T
This commit is contained in:
1 parent
cf2953bc44
commit
aca7e2fa3b
1 file changed
+4
-2
@@ -5816,7 +5816,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyName(prop: Symbol) {
|
||||
return startsWith(prop.name, "__@") ? neverType : getLiteralTypeForText(TypeFlags.StringLiteral, unescapeIdentifier(prop.name));
|
||||
return getDeclarationModifierFlagsFromSymbol(prop) & ModifierFlags.NonPublicAccessibilityModifier || startsWith(prop.name, "__@") ?
|
||||
neverType :
|
||||
getLiteralTypeForText(TypeFlags.StringLiteral, unescapeIdentifier(prop.name));
|
||||
}
|
||||
|
||||
function getLiteralTypeFromPropertyNames(type: Type) {
|
||||
@@ -7044,7 +7046,7 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if (isGenericMappedType(target)) {
|
||||
if (isGenericMappedType(target)) {
|
||||
// A type [P in S]: X is related to a type [P in T]: X if T is related to S.
|
||||
if (isGenericMappedType(source) &&
|
||||
isRelatedTo(getConstraintTypeFromMappedType(<MappedType>target), getConstraintTypeFromMappedType(<MappedType>source), /*reportErrors*/ false) &&
|
||||
|
||||
Reference in new issue
Block a user