@@ -32323,16 +32323,13 @@ namespace ts {
32323
32323
if (otherAccessor) {
32324
32324
const nodeFlags = getEffectiveModifierFlags(node);
32325
32325
const otherFlags = getEffectiveModifierFlags(otherAccessor);
32326
- if ((nodeFlags & ModifierFlags.AccessibilityModifier) !== (otherFlags & ModifierFlags.AccessibilityModifier)) {
32327
- error(node.name, Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility);
32328
- }
32329
32326
if ((nodeFlags & ModifierFlags.Abstract) !== (otherFlags & ModifierFlags.Abstract)) {
32330
32327
error(node.name, Diagnostics.Accessors_must_both_be_abstract_or_non_abstract);
32331
32328
}
32332
32329
32333
32330
// TypeScript 1.0 spec (April 2014): 4.5
32334
32331
// If both accessors include type annotations, the specified types must be identical.
32335
- checkAccessorDeclarationTypesIdentical (node, otherAccessor, getAnnotatedAccessorType, Diagnostics.get_and_set_accessor_must_have_the_same_type );
32332
+ checkAccessorDeclarationTypesAssignable (node, otherAccessor, getAnnotatedAccessorType, Diagnostics.get_and_set_accessor_must_have_the_comparable_types );
32336
32333
checkAccessorDeclarationTypesIdentical(node, otherAccessor, getThisTypeOfDeclaration, Diagnostics.get_and_set_accessor_must_have_the_same_this_type);
32337
32334
}
32338
32335
}
@@ -32345,13 +32342,22 @@ namespace ts {
32345
32342
}
32346
32343
32347
32344
function checkAccessorDeclarationTypesIdentical(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type | undefined, message: DiagnosticMessage) {
32345
+ return checkAccessorDeclarationTypesMatch(first, second, getAnnotatedType, isTypeIdenticalTo, message);
32346
+ }
32347
+
32348
+ function checkAccessorDeclarationTypesAssignable(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type | undefined, message: DiagnosticMessage) {
32349
+ return checkAccessorDeclarationTypesMatch(first, second, getAnnotatedType, areTypesComparable, message);
32350
+ }
32351
+
32352
+ function checkAccessorDeclarationTypesMatch(first: AccessorDeclaration, second: AccessorDeclaration, getAnnotatedType: (a: AccessorDeclaration) => Type | undefined, match: typeof areTypesComparable, message: DiagnosticMessage) {
32348
32353
const firstType = getAnnotatedType(first);
32349
32354
const secondType = getAnnotatedType(second);
32350
- if (firstType && secondType && !isTypeIdenticalTo (firstType, secondType)) {
32355
+ if (firstType && secondType && !match (firstType, secondType)) {
32351
32356
error(first, message);
32352
32357
}
32353
32358
}
32354
32359
32360
+
32355
32361
function checkMissingDeclaration(node: Node) {
32356
32362
checkDecorators(node);
32357
32363
}
0 commit comments