Skip to content

Commit d63cc5f

Browse files
Update LKG.
1 parent 35d26f5 commit d63cc5f

File tree

6 files changed

+518
-242
lines changed

6 files changed

+518
-242
lines changed

lib/tsc.js

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
6161
var ts;
6262
(function (ts) {
6363
ts.versionMajorMinor = "3.2";
64-
ts.version = ts.versionMajorMinor + ".2";
64+
ts.version = ts.versionMajorMinor + ".3";
6565
})(ts || (ts = {}));
6666
(function (ts) {
6767
ts.emptyArray = [];
@@ -26268,7 +26268,8 @@ var ts;
2626826268
}
2626926269
}
2627026270
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; })) {
2627226273
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));
2627326274
}
2627426275
}
@@ -29350,12 +29351,11 @@ var ts;
2935029351
if (ts.isCatchClauseVariableDeclarationOrBindingElement(declaration)) {
2935129352
return anyType;
2935229353
}
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) {
2935629356
return emptyObjectType;
2935729357
}
29358-
var type_1 = getWidenedLiteralType(checkExpression(jsonSourceFile.statements[0].expression));
29358+
var type_1 = getWidenedLiteralType(checkExpression(declaration.statements[0].expression));
2935929359
if (type_1.flags & 524288) {
2936029360
return getRegularTypeOfObjectLiteral(type_1);
2936129361
}
@@ -29378,7 +29378,8 @@ var ts;
2937829378
|| ts.isClassDeclaration(declaration)
2937929379
|| ts.isFunctionDeclaration(declaration)
2938029380
|| (ts.isMethodDeclaration(declaration) && !ts.isObjectLiteralMethod(declaration))
29381-
|| ts.isMethodSignature(declaration)) {
29381+
|| ts.isMethodSignature(declaration)
29382+
|| ts.isSourceFile(declaration)) {
2938229383
if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) {
2938329384
return getTypeOfFuncClassEnumModule(symbol);
2938429385
}
@@ -32989,23 +32990,23 @@ var ts;
3298932990
if (checkType === wildcardType || extendsType === wildcardType) {
3299032991
return wildcardType;
3299132992
}
32992-
var isDeferred = root.isDistributive && maybeTypeOfKind(checkType, 63176704);
32993+
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704);
3299332994
var combinedMapper;
3299432995
if (root.inferTypeParameters) {
3299532996
var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
32996-
if (!isDeferred) {
32997+
if (!checkTypeInstantiable) {
3299732998
inferTypes(context.inferences, checkType, extendsType, 32 | 64);
3299832999
}
3299933000
combinedMapper = combineTypeMappers(mapper, context);
3300033001
}
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) {
3300333005
return instantiateType(root.trueType, mapper);
3300433006
}
3300533007
if (checkType.flags & 1) {
3300633008
return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
3300733009
}
33008-
var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
3300933010
if (!isTypeAssignableTo(getWildcardInstantiation(checkType), getWildcardInstantiation(inferredExtendsType))) {
3301033011
return instantiateType(root.falseType, mapper);
3301133012
}
@@ -34694,7 +34695,7 @@ var ts;
3469434695
if (!noImplicitAny && ts.getObjectFlags(target) & 16384) {
3469534696
return false;
3469634697
}
34697-
if (maybeTypeOfKind(target, 524288) && !(ts.getObjectFlags(target) & 512)) {
34698+
if (isExcessPropertyCheckTarget(target)) {
3469834699
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096);
3469934700
if ((relation === assignableRelation || relation === definitelyAssignableRelation || relation === comparableRelation) &&
3470034701
(isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) {
@@ -34706,10 +34707,11 @@ var ts;
3470634707
var _loop_6 = function (prop) {
3470734708
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) {
3470834709
if (reportErrors) {
34710+
var errorTarget = filterType(target, isExcessPropertyCheckTarget);
3470934711
if (!errorNode)
3471034712
return { value: ts.Debug.fail() };
3471134713
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));
3471334715
}
3471434716
else {
3471534717
var objectLiteralDeclaration_1 = source.symbol && ts.firstOrUndefined(source.symbol.declarations);
@@ -34720,14 +34722,14 @@ var ts;
3472034722
errorNode = propDeclaration;
3472134723
var name = propDeclaration.name;
3472234724
if (ts.isIdentifier(name)) {
34723-
suggestion = getSuggestionForNonexistentProperty(name, target);
34725+
suggestion = getSuggestionForNonexistentProperty(name, errorTarget);
3472434726
}
3472534727
}
3472634728
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);
3472834730
}
3472934731
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));
3473134733
}
3473234734
}
3473334735
}
@@ -37005,17 +37007,15 @@ var ts;
3700537007
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
3700637008
isMatchingReference(source.expression, target.expression);
3700737009
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+
}
3701937019
}
3702037020
}
3702137021
return false;
@@ -37025,14 +37025,24 @@ var ts;
3702537025
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
3702637026
undefined;
3702737027
}
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+
}
3702837038
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)) {
3703237042
return true;
3703337043
}
37044+
parent = getReferenceParent(parent);
3703437045
}
37035-
return false;
3703637046
}
3703737047
function containsMatchingReferenceDiscriminant(source, target) {
3703837048
return target.kind === 189 &&
@@ -40059,20 +40069,22 @@ var ts;
4005940069
return true;
4006040070
}
4006140071
}
40062-
else if (targetType.flags & 3145728) {
40072+
else if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType)) {
4006340073
for (var _i = 0, _a = targetType.types; _i < _a.length; _i++) {
4006440074
var t = _a[_i];
4006540075
if (isKnownProperty(t, name, isComparingJsxAttributes)) {
4006640076
return true;
4006740077
}
4006840078
}
4006940079
}
40070-
else if (targetType.flags & 16777216) {
40071-
return isKnownProperty(targetType.root.trueType, name, isComparingJsxAttributes) ||
40072-
isKnownProperty(targetType.root.falseType, name, isComparingJsxAttributes);
40073-
}
4007440080
return false;
4007540081
}
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+
}
4007640088
function checkJsxExpression(node, checkMode) {
4007740089
if (node.expression) {
4007840090
var type = checkExpression(node.expression, checkMode);

0 commit comments

Comments
 (0)