@@ -4187,14 +4187,17 @@ namespace ts {
4187
4187
else {
4188
4188
// Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form)
4189
4189
const name = declaration.propertyName || <Identifier>declaration.name;
4190
- if (isComputedNonLiteralName(name)) {
4191
- // computed properties with non-literal names are treated as 'any'
4190
+ const isLate = isLateBindableName(name);
4191
+ const isWellKnown = isComputedPropertyName(name) && isWellKnownSymbolSyntactically(name.expression);
4192
+ if (!isLate && !isWellKnown && isComputedNonLiteralName(name)) {
4192
4193
return anyType;
4193
4194
}
4194
4195
4195
4196
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
4196
4197
// or otherwise the type of the string index signature.
4197
- const text = getTextOfPropertyName(name);
4198
+ const text = isLate ? getLateBoundNameFromType(checkComputedPropertyName(name as ComputedPropertyName) as LiteralType | UniqueESSymbolType) :
4199
+ isWellKnown ? getPropertyNameForKnownSymbolName(idText(((name as ComputedPropertyName).expression as PropertyAccessExpression).name)) :
4200
+ getTextOfPropertyName(name);
4198
4201
4199
4202
// Relax null check on ambient destructuring parameters, since the parameters have no implementation and are just documentation
4200
4203
if (strictNullChecks && declaration.flags & NodeFlags.Ambient && isParameterDeclaration(declaration)) {
@@ -4380,7 +4383,7 @@ namespace ts {
4380
4383
for (const declaration of symbol.declarations!) {
4381
4384
let declarationInConstructor = false;
4382
4385
const expression = declaration.kind === SyntaxKind.BinaryExpression ? <BinaryExpression>declaration :
4383
- declaration.kind === SyntaxKind.PropertyAccessExpression ? <BinaryExpression>getAncestor (declaration, SyntaxKind.BinaryExpression ) :
4386
+ declaration.kind === SyntaxKind.PropertyAccessExpression ? cast (declaration.parent, isBinaryExpression ) :
4384
4387
undefined;
4385
4388
4386
4389
if (!expression) {
@@ -13921,7 +13924,8 @@ namespace ts {
13921
13924
const assignmentKind = getAssignmentTargetKind(node);
13922
13925
13923
13926
if (assignmentKind) {
13924
- if (!(localOrExportSymbol.flags & SymbolFlags.Variable)) {
13927
+ if (!(localOrExportSymbol.flags & SymbolFlags.Variable) &&
13928
+ !(isInJavaScriptFile(node) && localOrExportSymbol.flags & SymbolFlags.ValueModule)) {
13925
13929
error(node, Diagnostics.Cannot_assign_to_0_because_it_is_not_a_variable, symbolToString(symbol));
13926
13930
return unknownType;
13927
13931
}
@@ -19137,6 +19141,9 @@ namespace ts {
19137
19141
19138
19142
const links = getNodeLinks(node);
19139
19143
const type = getTypeOfSymbol(node.symbol!);
19144
+ if (isTypeAny(type)) {
19145
+ return type;
19146
+ }
19140
19147
19141
19148
// Check if function expression is contextually typed and assign parameter types if so.
19142
19149
if (!(links.flags! & NodeCheckFlags.ContextChecked)) {
@@ -19902,8 +19909,9 @@ namespace ts {
19902
19909
// VarExpr = ValueExpr
19903
19910
// requires VarExpr to be classified as a reference
19904
19911
// A compound assignment furthermore requires VarExpr to be classified as a reference (section 4.1)
19905
- // and the type of the non - compound operation to be assignable to the type of VarExpr.
19906
- if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)) {
19912
+ // and the type of the non-compound operation to be assignable to the type of VarExpr.
19913
+ if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access)
19914
+ && (!isIdentifier(left) || unescapeLeadingUnderscores(left.escapedText) !== "exports")) {
19907
19915
// to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported
19908
19916
checkTypeAssignableTo(valueType, leftType, left, /*headMessage*/ undefined);
19909
19917
}
@@ -21927,6 +21935,10 @@ namespace ts {
21927
21935
// and give a better error message when the host function mentions `arguments`
21928
21936
// but the tag doesn't have an array type
21929
21937
if (decl) {
21938
+ const i = getJSDocTags(decl).filter(isJSDocParameterTag).indexOf(node);
21939
+ if (i > -1 && i < decl.parameters.length && isBindingPattern(decl.parameters[i].name)) {
21940
+ return;
21941
+ }
21930
21942
if (!containsArgumentsReference(decl)) {
21931
21943
error(node.name,
21932
21944
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name,
0 commit comments