()
| 64751 | (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]); |
| 64752 | } |
| 64753 | function reportIncompatibleStack() { |
| 64754 | var stack = incompatibleStack || []; |
| 64755 | incompatibleStack = undefined; |
| 64756 | var info = lastSkippedInfo; |
| 64757 | lastSkippedInfo = undefined; |
| 64758 | if (stack.length === 1) { |
| 64759 | reportError.apply(void 0, stack[0]); |
| 64760 | if (info) { |
| 64761 | // Actually do the last relation error |
| 64762 | reportRelationError.apply(void 0, __spreadArray([/*headMessage*/ undefined], info, false)); |
| 64763 | } |
| 64764 | return; |
| 64765 | } |
| 64766 | // The first error will be the innermost, while the last will be the outermost - so by popping off the end, |
| 64767 | // we can build from left to right |
| 64768 | var path = ""; |
| 64769 | var secondaryRootErrors = []; |
| 64770 | while (stack.length) { |
| 64771 | var _a = stack.pop(), msg = _a[0], args = _a.slice(1); |
| 64772 | switch (msg.code) { |
| 64773 | case ts.Diagnostics.Types_of_property_0_are_incompatible.code: { |
| 64774 | // Parenthesize a `new` if there is one |
| 64775 | if (path.indexOf("new ") === 0) { |
| 64776 | path = "(".concat(path, ")"); |
| 64777 | } |
| 64778 | var str = "" + args[0]; |
| 64779 | // If leading, just print back the arg (irrespective of if it's a valid identifier) |
| 64780 | if (path.length === 0) { |
| 64781 | path = "".concat(str); |
| 64782 | } |
| 64783 | // Otherwise write a dotted name if possible |
| 64784 | else if (ts.isIdentifierText(str, ts.getEmitScriptTarget(compilerOptions))) { |
| 64785 | path = "".concat(path, ".").concat(str); |
| 64786 | } |
| 64787 | // Failing that, check if the name is already a computed name |
| 64788 | else if (str[0] === "[" && str[str.length - 1] === "]") { |
| 64789 | path = "".concat(path).concat(str); |
| 64790 | } |
| 64791 | // And finally write out a computed name as a last resort |
| 64792 | else { |
| 64793 | path = "".concat(path, "[").concat(str, "]"); |
| 64794 | } |
| 64795 | break; |
| 64796 | } |
| 64797 | case ts.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible.code: |
| 64798 | case ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible.code: |
| 64799 | case ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: |
| 64800 | case ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code: { |
| 64801 | if (path.length === 0) { |
| 64802 | // Don't flatten signature compatability errors at the start of a chain - instead prefer |
| 64803 | // to unify (the with no arguments bit is excessive for printback) and print them back |
| 64804 | var mappedMsg = msg; |
| 64805 | if (msg.code === ts.Diagnostics.Call_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { |
| 64806 | mappedMsg = ts.Diagnostics.Call_signature_return_types_0_and_1_are_incompatible; |
| 64807 | } |
| 64808 | else if (msg.code === ts.Diagnostics.Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1.code) { |
| 64809 | mappedMsg = ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible; |
| 64810 | } |
no test coverage detected
searching dependent graphs…