TypeScript
TypeScript copied to clipboard
fix issue 53775, do not always narrow to property signature
Fixes #53775
add one more case when transforming AST in emit stage. in this case, we will check if accessor symbol's by following rule
// if (
// propertySymbol is accessor &&
//. This syombol has two declarations ( gettter and setter) &&
// (
// setter just has two more parameters ||
// setter has two parameters, first one is this keyword, second parameter's type and getter's return type is not identical ||
// setter has one parameter, setter's the only parameter's type and getter's return type is not identical
// )
// ) {
// In this case, this mean we can't narrow symbol to just one PropertySignature, it needs to be two types.
// So we push two typeNode, one is gettter TypeNode, the other is setter's typeNode to TypeElements Array
// }
// else fall to generic case (just add one typeNode to TypeElements)
this additional case will change some original test case's type file, because sometimes we wouldn't narrow setter and getter to just one PropertySignature.