-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.6 regression: Error: Debug Failure. No error for last overload signature
#33133
Comments
I added that assert in 3.6 to catch an incorrect state during error reporting. So, uh, looks like you caught it! This needs a smaller repro before I can continue. When I get to my desk I’ll come up with an assert message that dumps the current file or the text of the node. That way you can modify tsc.js to pinpoint the call. |
That would be great, thanks @sandersn |
Debug.fail("No error for last overload signature"); and change to var s = "\nCall:" + getTextOfNode(node) + "\nDeclarations:\t" + candidatesForArgumentError.map(c => c.declaration ? getTextOfNode(c.declaration) : "no declaration found").join(",");
Debug.fail("No error for last overload signature" + s); We should consider making |
Had to change $ tsc --project tsconfig.json
/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:75635
throw e;
^
Error: Debug Failure. No error for last overload signature
Call:<ComposedComponent
{
// Cast is workaround for https://github.com/microsoft/TypeScript/issues/28884
...({
renderType,
...this.props,
} as ComposedProps)
}
/>
Declarations: (props: PropsWithChildren<P>, context?: any): ReactElement | null;
at resolveCall (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:43577:38)
at resolveJsxOpeningLikeElement (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44149:20)
at resolveSignature (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44170:28)
at getResolvedSignature (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44181:26)
at checkJsxOpeningLikeElementOrOpeningFragment (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:42398:27)
at checkJsxSelfClosingElementDeferred (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:42042:13)
at checkDeferredNode (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50212:21)
at Map.forEach (<anonymous>)
at checkDeferredNodes (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50190:37)
at checkSourceFileWorker (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50250:17) The code printed in this error is from this file: https://gist.github.com/OliverJAsh/bebfe1c5690d2e79317103c2b6c4bb9e |
Thanks, that's a pretty small repro. Hopefully the external dependencies (besides react) are not needed. |
Here's a reduced test case:
{
"dependencies": {
"@types/react": "16.9.2",
"typescript": "3.6.2"
}
}
{
"compilerOptions": {
"target": "es2015",
"jsx": "react",
"moduleResolution": "node"
}
}
import * as React from 'react';
import { Component, ComponentType } from 'react';
const getDisplayName = (ComposedComponent: ComponentType<unknown>) =>
ComposedComponent.displayName;
type RenderTypeProp = { renderType: object };
export const withRenderType = <ComposedProps extends RenderTypeProp>(
ComposedComponent: ComponentType<ComposedProps>,
) => {
const displayName = `WithRenderType(${getDisplayName(ComposedComponent)})`;
class WithRenderType extends Component<ComposedProps> {
static displayName = displayName;
render() {
return <ComposedComponent {...(this.props as ComposedProps)} />;
}
}
return WithRenderType;
}; |
Workaround for now: - const displayName = `WithRenderType(${getDisplayName(ComposedComponent)})`;
+ const displayName = `WithRenderType(${ComposedComponent.displayName})`; |
Requires |
Specifically, |
Smaller repro: import { ComponentType } from 'react';
declare function getDisplayName(ComposedComponent: ComponentType<unknown>): string;
export function wu<CP extends { renderType: object }>(CC: ComponentType<CP>) {
class WU {
m() {
getDisplayName(CC)
return <CC {...(this.props as CP)} />;
}
}
}; |
Standalone repro: interface F<P> {
(props: P & { children?: boolean }): void;
propTypes: { [K in keyof P]: null extends P ? K : K };
}
declare function g(C: F<unknown>): string;
export function wu<CP extends { o: object }>(CC: F<CP>) {
class WU {
m() {
g(CC)
return <CC {...(null as CP)} />;
}
}
} This is, admittedly, super weird. |
The basic problem is that the flag |
@sandersn Works for me now in |
isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. #33133 provides an example of such a program. Fixes #33133 the right way, so I reverted the fix at #33213 Fixes #34762 (by reverting #33213) Fixes #33944 -- I added the test from #34646
* Add isIntersectionConstituent to relation key isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. #33133 provides an example of such a program. Fixes #33133 the right way, so I reverted the fix at #33213 Fixes #34762 (by reverting #33213) Fixes #33944 -- I added the test from #34646 * Update comments in test
Component commits: 2e0b451 Add isIntersectionConstituent to relation key isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. microsoft#33133 provides an example of such a program. Fixes microsoft#33133 the right way, so I reverted the fix at microsoft#33213 Fixes microsoft#34762 (by reverting microsoft#33213) Fixes microsoft#33944 -- I added the test from microsoft#34646 14d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key ea80362 Update comments in test 0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
Component commits: 2e0b451 Add isIntersectionConstituent to relation key isIntersectionConstituent controls whether relation checking performs excess property and common property checks. It is possible to fail a relation check with excess property checks turned on, cache the result, and then skip a relation check with excess property checks that would have succeeded. #33133 provides an example of such a program. Fixes #33133 the right way, so I reverted the fix at #33213 Fixes #34762 (by reverting #33213) Fixes #33944 -- I added the test from #34646 14d7a44 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key ea80362 Update comments in test 0764275 Merge branch 'master' into add-isIntersectionConstituent-to-relation-key
I ran into this with 3.8. Should I try to make a reproduction repo? For my own ref: this happened at |
would be handy to have this handy workaround released to get some useful insight when this kind of error eventually emerge ! |
I just had this happen in It doesn't show errors in VSCode though. only when I run The line that is blowing up is using a type from |
Also hitting this when trying to use prisma extensions https://www.prisma.io/docs/orm/prisma-client/client-extensions with derived return type (https://www.prisma.io/docs/orm/prisma-client/client-extensions#type-of-an-extended-client). |
TypeScript Version: 3.6.2
Search Terms: debug failure overload signature
After upgrading our large app from TS 3.5.2 to to TS 3.6.2, we get the following error when running
tsc
:The text was updated successfully, but these errors were encountered: