@@ -61,7 +61,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
61
61
var ts;
62
62
(function (ts) {
63
63
ts.versionMajorMinor = "3.2";
64
- ts.version = ts.versionMajorMinor + ".2 ";
64
+ ts.version = ts.versionMajorMinor + ".3 ";
65
65
})(ts || (ts = {}));
66
66
(function (ts) {
67
67
ts.emptyArray = [];
@@ -26268,7 +26268,8 @@ var ts;
26268
26268
}
26269
26269
}
26270
26270
if (result && isInExternalModule && (meaning & 67220415) === 67220415 && !(originalLocation.flags & 2097152)) {
26271
- if (ts.some(result.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
26271
+ var merged = getMergedSymbol(result);
26272
+ if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
26272
26273
error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
26273
26274
}
26274
26275
}
@@ -29350,12 +29351,11 @@ var ts;
29350
29351
if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
29351
29352
return anyType;
29352
29353
}
29353
- if (ts.isSourceFile(declaration)) {
29354
- var jsonSourceFile = ts.cast(declaration, ts.isJsonSourceFile);
29355
- if (!jsonSourceFile.statements.length) {
29354
+ if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
29355
+ if (!declaration.statements.length) {
29356
29356
return emptyObjectType;
29357
29357
}
29358
- var type_1 = getWidenedLiteralType(checkExpression(jsonSourceFile .statements[0].expression));
29358
+ var type_1 = getWidenedLiteralType(checkExpression(declaration .statements[0].expression));
29359
29359
if (type_1.flags & 524288) {
29360
29360
return getRegularTypeOfObjectLiteral(type_1);
29361
29361
}
@@ -29378,7 +29378,8 @@ var ts;
29378
29378
|| ts.isClassDeclaration(declaration)
29379
29379
|| ts.isFunctionDeclaration(declaration)
29380
29380
|| (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
29381
- || ts.isMethodSignature(declaration)) {
29381
+ || ts.isMethodSignature(declaration)
29382
+ || ts.isSourceFile(declaration)) {
29382
29383
if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
29383
29384
return getTypeOfFuncClassEnumModule(symbol);
29384
29385
}
@@ -32989,23 +32990,23 @@ var ts;
32989
32990
if (checkType === wildcardType || extendsType === wildcardType) {
32990
32991
return wildcardType;
32991
32992
}
32992
- var isDeferred = root.isDistributive && maybeTypeOfKind(checkType, 63176704);
32993
+ var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704);
32993
32994
var combinedMapper;
32994
32995
if (root.inferTypeParameters) {
32995
32996
var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
32996
- if (!isDeferred ) {
32997
+ if (!checkTypeInstantiable ) {
32997
32998
inferTypes(context.inferences, checkType, extendsType, 32 | 64);
32998
32999
}
32999
33000
combinedMapper = combineTypeMappers(mapper, context);
33000
33001
}
33001
- if (!isDeferred) {
33002
- if (extendsType.flags & 3) {
33002
+ var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
33003
+ if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704)) {
33004
+ if (inferredExtendsType.flags & 3) {
33003
33005
return instantiateType(root.trueType, mapper);
33004
33006
}
33005
33007
if (checkType.flags & 1) {
33006
33008
return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
33007
33009
}
33008
- var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
33009
33010
if (!isTypeAssignableTo(getWildcardInstantiation(checkType), getWildcardInstantiation(inferredExtendsType))) {
33010
33011
return instantiateType(root.falseType, mapper);
33011
33012
}
@@ -34694,7 +34695,7 @@ var ts;
34694
34695
if (!noImplicitAny && ts.getObjectFlags(target) & 16384) {
34695
34696
return false;
34696
34697
}
34697
- if (maybeTypeOfKind (target, 524288) && !(ts.getObjectFlags(target) & 512 )) {
34698
+ if (isExcessPropertyCheckTarget (target)) {
34698
34699
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096);
34699
34700
if ((relation === assignableRelation || relation === definitelyAssignableRelation || relation === comparableRelation) &&
34700
34701
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
@@ -34706,10 +34707,11 @@ var ts;
34706
34707
var _loop_6 = function (prop) {
34707
34708
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
34708
34709
if (reportErrors) {
34710
+ var errorTarget = filterType(target, isExcessPropertyCheckTarget);
34709
34711
if (!errorNode)
34710
34712
return { value: ts.Debug.fail() };
34711
34713
if (ts.isJsxAttributes(errorNode) || ts.isJsxOpeningLikeElement(errorNode) || ts.isJsxOpeningLikeElement(errorNode.parent)) {
34712
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(target ));
34714
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(prop), typeToString(errorTarget ));
34713
34715
}
34714
34716
else {
34715
34717
var objectLiteralDeclaration_1 = source.symbol && ts.firstOrUndefined(source.symbol.declarations);
@@ -34720,14 +34722,14 @@ var ts;
34720
34722
errorNode = propDeclaration;
34721
34723
var name = propDeclaration.name;
34722
34724
if (ts.isIdentifier(name)) {
34723
- suggestion = getSuggestionForNonexistentProperty(name, target );
34725
+ suggestion = getSuggestionForNonexistentProperty(name, errorTarget );
34724
34726
}
34725
34727
}
34726
34728
if (suggestion !== undefined) {
34727
- reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(target ), suggestion);
34729
+ reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_write_2, symbolToString(prop), typeToString(errorTarget ), suggestion);
34728
34730
}
34729
34731
else {
34730
- reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target ));
34732
+ reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(errorTarget ));
34731
34733
}
34732
34734
}
34733
34735
}
@@ -37005,17 +37007,15 @@ var ts;
37005
37007
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
37006
37008
isMatchingReference(source.expression, target.expression);
37007
37009
case 186:
37008
- if (target.kind !== 189)
37009
- return false;
37010
- var t = target;
37011
- if (t.name.escapedText !== getBindingElementNameText(source))
37012
- return false;
37013
- if (source.parent.parent.kind === 186 && isMatchingReference(source.parent.parent, t.expression)) {
37014
- return true;
37015
- }
37016
- if (source.parent.parent.kind === 237) {
37017
- var maybeId = source.parent.parent.initializer;
37018
- return !!maybeId && isMatchingReference(maybeId, t.expression);
37010
+ if (target.kind === 189 && target.name.escapedText === getBindingElementNameText(source)) {
37011
+ var ancestor = source.parent.parent;
37012
+ if (ancestor.kind === 186) {
37013
+ return isMatchingReference(ancestor, target.expression);
37014
+ }
37015
+ if (ancestor.kind === 237) {
37016
+ var initializer = ancestor.initializer;
37017
+ return !!initializer && isMatchingReference(initializer, target.expression);
37018
+ }
37019
37019
}
37020
37020
}
37021
37021
return false;
@@ -37025,14 +37025,24 @@ var ts;
37025
37025
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
37026
37026
undefined;
37027
37027
}
37028
+ function getReferenceParent(source) {
37029
+ if (source.kind === 189) {
37030
+ return source.expression;
37031
+ }
37032
+ if (source.kind === 186) {
37033
+ var ancestor = source.parent.parent;
37034
+ return ancestor.kind === 237 ? ancestor.initializer : ancestor;
37035
+ }
37036
+ return undefined;
37037
+ }
37028
37038
function containsMatchingReference(source, target) {
37029
- while (source.kind === 189) {
37030
- source = source.expression;
37031
- if (isMatchingReference(source , target)) {
37039
+ var parent = getReferenceParent(source);
37040
+ while (parent) {
37041
+ if (isMatchingReference(parent , target)) {
37032
37042
return true;
37033
37043
}
37044
+ parent = getReferenceParent(parent);
37034
37045
}
37035
- return false;
37036
37046
}
37037
37047
function containsMatchingReferenceDiscriminant(source, target) {
37038
37048
return target.kind === 189 &&
@@ -40059,20 +40069,22 @@ var ts;
40059
40069
return true;
40060
40070
}
40061
40071
}
40062
- else if (targetType.flags & 3145728) {
40072
+ else if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType) ) {
40063
40073
for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) {
40064
40074
var t = _a[_i];
40065
40075
if (isKnownProperty(t, name, isComparingJsxAttributes)) {
40066
40076
return true;
40067
40077
}
40068
40078
}
40069
40079
}
40070
- else if (targetType.flags & 16777216) {
40071
- return isKnownProperty(targetType.root.trueType, name, isComparingJsxAttributes) ||
40072
- isKnownProperty(targetType.root.falseType, name, isComparingJsxAttributes);
40073
- }
40074
40080
return false;
40075
40081
}
40082
+ function isExcessPropertyCheckTarget(type) {
40083
+ return !!(type.flags & 524288 && !(ts.getObjectFlags(type) & 512) ||
40084
+ type.flags & 67108864 ||
40085
+ type.flags & 1048576 && ts.some(type.types, isExcessPropertyCheckTarget) ||
40086
+ type.flags & 2097152 && ts.every(type.types, isExcessPropertyCheckTarget));
40087
+ }
40076
40088
function checkJsxExpression(node, checkMode) {
40077
40089
if (node.expression) {
40078
40090
var type = checkExpression(node.expression, checkMode);
0 commit comments