(signatureLists, signature, listIndex)
| 58068 | } |
| 58069 | } |
| 58070 | function findMatchingSignatures(signatureLists, signature, listIndex) { |
| 58071 | if (signature.typeParameters) { |
| 58072 | // We require an exact match for generic signatures, so we only return signatures from the first |
| 58073 | // signature list and only if they have exact matches in the other signature lists. |
| 58074 | if (listIndex > 0) { |
| 58075 | return undefined; |
| 58076 | } |
| 58077 | for (var i = 1; i < signatureLists.length; i++) { |
| 58078 | if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ false)) { |
| 58079 | return undefined; |
| 58080 | } |
| 58081 | } |
| 58082 | return [signature]; |
| 58083 | } |
| 58084 | var result; |
| 58085 | for (var i = 0; i < signatureLists.length; i++) { |
| 58086 | // Allow matching non-generic signatures to have excess parameters and different return types. |
| 58087 | // Prefer matching this types if possible. |
| 58088 | var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreThisTypes*/ false, /*ignoreReturnTypes*/ true); |
| 58089 | if (!match) { |
| 58090 | return undefined; |
| 58091 | } |
| 58092 | result = ts.appendIfUnique(result, match); |
| 58093 | } |
| 58094 | return result; |
| 58095 | } |
| 58096 | // The signatures of a union type are those signatures that are present in each of the constituent types. |
| 58097 | // Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional |
| 58098 | // parameters and may differ in return types. When signatures differ in return types, the resulting return |
no test coverage detected