Missing properties in fresh object literals are known to be undefined
This commit is contained in:
parent
228a885e49
commit
b17e75b52b
2 changed files with 10 additions and 1 deletions
|
@ -9604,6 +9604,15 @@ namespace ts {
|
|||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
if (relation === subtypeRelation && target.flags & TypeFlags.FreshLiteral) {
|
||||
const excessProperty = getUnmatchedProperty(target, source, /*requireOptionalProperties*/ true);
|
||||
if (excessProperty) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(excessProperty), typeToString(target));
|
||||
}
|
||||
return Ternary.False;
|
||||
}
|
||||
}
|
||||
let result = Ternary.True;
|
||||
const properties = getPropertiesOfObjectType(target);
|
||||
for (const targetProp of properties) {
|
||||
|
|
|
@ -1273,7 +1273,7 @@ namespace ts {
|
|||
return result;
|
||||
}
|
||||
|
||||
function getDefaultValueForOption(option: CommandLineOption) {
|
||||
function getDefaultValueForOption(option: CommandLineOption): {} {
|
||||
switch (option.type) {
|
||||
case "number":
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue