mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 03:09:59 -05:00
Remove undefined from optional properties when inferring to index signatures (#43086)
* Remove undefined from optional properties when inferring to index signatures * Add tests
This commit is contained in:
@@ -11777,7 +11777,8 @@ namespace ts {
|
||||
const propTypes: Type[] = [];
|
||||
for (const prop of getPropertiesOfType(type)) {
|
||||
if (kind === IndexKind.String || isNumericLiteralName(prop.escapedName)) {
|
||||
propTypes.push(getTypeOfSymbol(prop));
|
||||
const propType = getTypeOfSymbol(prop);
|
||||
propTypes.push(prop.flags & SymbolFlags.Optional ? getTypeWithFacts(propType, TypeFacts.NEUndefined) : propType);
|
||||
}
|
||||
}
|
||||
if (kind === IndexKind.String) {
|
||||
|
||||
Reference in New Issue
Block a user