-
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
New error: Excessive stack depth comparing types #37600
Comments
OK, so, two seperate things going on here, probably. The first one, from the title: the change that introduced this definitely seems to be #37195. The structural comparison of the source intersection to the target is definitely what triggers the new errors. Now, what's going on is we have export type ContentPluginProps<
// tslint:disable-next-line:no-any
T = any
> = ContentPluginExtraProps & PluginProps<T, ContentPluginExtraProps<T>>; both {
Component?: PluginComponentType<ContentPluginProps<T>>;
} and {
Component?: PluginComponentType<
PluginProps<StateT, ExtraPropsT> & ExtraPropsT
>;
} The comparison stack between the expression type and that intersection is maybe too long to reasonably explain thoroughly, but suffice to say that we end up pingponging around between the proprieties on a class/function component which refer to props ( There is a trivial fix/workaround/improvement which can be applied to export type ContentPluginProps<
// tslint:disable-next-line:no-any
T = any
> = ContentPluginExtraProps<T> & PluginProps<T, ContentPluginExtraProps<T>>; actually providing @ahejlsberg because this is resolvable with an increase to maximal Now, the other issue, the circular reference in mapped type thing, I have yet to look at. I'll look into it next. |
The circular mapped type properties are new (the error itself is new, the behavior leading to the circularity used to simply cache an type Selector<S, R> = (state: S) => R;
declare function createStructuredSelector<S, T>(
selectors: {[K in keyof T]: Selector<S, T[K]>},
): Selector<S, T>;
const editable = () => ({});
const mapStateToProps = createStructuredSelector({
editable: (state: any, props: any) => editable(),
}); the circular reference error goes away if the arity perfectly matches, however in the real world example scenario, this is just one of two overloads for |
So many things went wrong that I'm just going to paste the list of errors here.
One location for context: https://github.com/react-page/react-page/blob/fb17a032bd6415080e468c0a43fd0f9c45a22cbe/packages/core/src/service/plugin/default.tsx#L51
To repro:
yarn
tsc -b -f packages
The text was updated successfully, but these errors were encountered: