Closed
Description
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
error TS2321: Excessive stack depth comparing types '{ Component: SFC<ContentPluginProps<{ value: string; }>>; name: string; version: string; createInitialState: () => { value: string; }; }' and 'Pick<ContentPluginProps<{}>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | ... 9 more ... | "createInitialState">'.
packages/core/src/service/plugin/default.tsx:51:3 - error TS2322: Type 'SFC<ContentPluginProps<{ value: string; }>>' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{}, ContentPluginExtraProps<{}>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'FunctionComponent<ContentPluginProps<{ value: string; }>>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any> & FunctionComponent<PluginProps<{}, ContentPluginExtraProps<{}>> & ContentPluginExtraProps<...>>'.
Type 'FunctionComponent<ContentPluginProps<{ value: string; }>>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any>'.
The types of 'propTypes.Component' are incompatible between these types.
Type 'Validator<(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{ value: string; }, ContentPluginExtraProps<{ value: string; }>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & Fun...' is not assignable to type 'Validator<(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)>'.
Type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{ value: string; }, ContentPluginExtraProps<{ value: string; }>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionCompo...' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{ value: string; }, ContentPluginExtraProps<{ value: string; }>> & ContentPluginExtraProps<...>, any>' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{ value: string; }, ContentPluginExtraProps<{ value: string; }>> & ContentPluginExtraProps<...>, any>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<{ value: string; }, ContentPluginExtraProps<{ value: string; }>> & ContentPluginExtraProps<...>, any>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any>'.
The types of 'propTypes.Component[nominalTypeHack].type' are incompatible between these types.
Type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any> & ComponentClass<...> & FunctionComponent<...>) | ... 14 more ... | (FunctionComponent<...> & ... 2 more ... & ComponentClass<...>)' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any> & ComponentClass<...> & FunctionComponent<...>' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any> & ComponentClass<...> & FunctionComponent<...>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any> & FunctionComponent<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>>'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any> & ComponentClass<...> & FunctionComponent<...>' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any>'.
51 Component: Default,
~~~~~~~~~
packages/core/src/service/plugin/classes.ts:112:3
112 Component?: PluginComponentType<ContentPluginProps<T>>;
~~~~~~~~~
The expected type comes from property 'Component' which is declared here on type 'Pick<ContentPluginProps<{}>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | ... 9 more ... | "createInitialState">'
error TS2321: Excessive stack depth comparing types '{ Component: (props: ContentPluginProps<{}>) => Element; name: string; version: string; }' and 'Pick<ContentPluginProps<any>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | ... 9 more ... | "createInitialState">'.
packages/core/src/service/plugin/missing.tsx:51:3 - error TS2322: Type '(props: ContentPluginProps<{}>) => JSX.Element' is not assignable to type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type '(props: ContentPluginProps<{}>) => JSX.Element' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any> & FunctionComponent<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>>'.
Type '(props: ContentPluginProps<{}>) => JSX.Element' is not assignable to type 'ComponentClass<ContentPluginProps<any>, any>'.
Type '(props: ContentPluginProps<{}>) => Element' provides no match for the signature 'new (props: ContentPluginProps<any>, context?: any): Component<ContentPluginProps<any>, any, any>'.
51 Component: ContentMissingComponent,
~~~~~~~~~
packages/core/src/service/plugin/classes.ts:112:3
112 Component?: PluginComponentType<ContentPluginProps<T>>;
~~~~~~~~~
The expected type comes from property 'Component' which is declared here on type 'Pick<ContentPluginProps<any>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | ... 9 more ... | "createInitialState">'
packages/core/src/reducer/editable/index.ts:53:17 - error TS2322: Type '{ layout: { plugin: any; state: any; }; id: any; rows: { id: string; cells: { [key: string]: any; id: string; content?: { plugin: ContentPlugin<any>; state?: object; }; layout?: { plugin: LayoutPlugin<any>; state?: object; }; size?: number; }[]; }[]; ... 10 more ...; levels?: Levels; }' is not assignable to type 'AbstractCell<Row>'.
Types of property 'rows' are incompatible.
Type '{ id: string; cells: { [key: string]: any; id: string; content?: { plugin: ContentPlugin<any>; state?: object; }; layout?: { plugin: LayoutPlugin<any>; state?: object; }; size?: number; }[]; }[]' is not assignable to type 'Row[]'.
Type '{ id: string; cells: { [key: string]: any; id: string; content?: { plugin: ContentPlugin<any>; state?: object; }; layout?: { plugin: LayoutPlugin<any>; state?: object; }; size?: number; }[]; }' is not assignable to type 'Row'.
Types of property 'cells' are incompatible.
Type '{ [key: string]: any; id: string; content?: { plugin: ContentPlugin<any>; state?: object; }; layout?: { plugin: LayoutPlugin<any>; state?: object; }; size?: number; }[]' is not assignable to type 'AbstractCell<Row>[]'.
Type '{ [key: string]: any; id: string; content?: { plugin: ContentPlugin<any>; state?: object; }; layout?: { plugin: LayoutPlugin<any>; state?: object; }; size?: number; }' is not assignable to type 'AbstractCell<Row>'.
The types of 'layout.plugin.handleFocus' are incompatible between these types.
Type '(props: ContentPluginProps<any>, focusSource: string, ref: HTMLElement) => void' is not assignable to type '(props: PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<any>, focusSource: string, ref: HTMLElement) => void'.
Types of parameters 'props' and 'props' are incompatible.
Type 'PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<any>' is not assignable to type 'ContentPluginProps<any>'.
Type 'PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<any>' is missing the following properties from type 'ContentPluginExtraProps<any>': isEditMode, isResizeMode, isInsertMode, isPreviewMode, isLayoutMode
53 const c: Cell = {
~
packages/core/src/components/HotKey/Decorator.tsx:194:50 - error TS2615: Type of property 'editable' circularly references itself in mapped type '{ isEditMode: Selector<unknown, boolean>; focus: Selector<unknown, string>; node: Selector<unknown, (id: string, _editable: string) => Row | AbstractCell<Row>>; searchNodeEverywhere: Selector<...>; editable: Selector<...>; editables: Selector<...>; }'.
194 const mapStateToProps = createStructuredSelector({
~
195 isEditMode,
~~~~~~~~~~~~~
...
204 editables,
~~~~~~~~~~~~
205 });
~
packages/core/src/components/Row/index.tsx:65:50 - error TS2615: Type of property 'rawNode' circularly references itself in mapped type '{ isLayoutMode: Selector<unknown, boolean>; config: Selector<unknown, Config>; isResizeMode: Selector<unknown, boolean>; isInsertMode: Selector<unknown, boolean>; isEditMode: Selector<...>; node: Selector<...>; rawNode: Selector<...>; }'.
65 const mapStateToProps = createStructuredSelector({
~
66 isLayoutMode,
~~~~~~~~~~~~~~~
...
73 node(state, props),
~~~~~~~~~~~~~~~~~~~~~~~
74 });
~
packages/core/src/components/Cell/index.tsx:121:50 - error TS2615: Type of property 'rawNode' circularly references itself in mapped type '{ isPreviewMode: Selector<unknown, boolean>; isEditMode: Selector<unknown, boolean>; isResizeMode: Selector<unknown, boolean>; isInsertMode: Selector<unknown, boolean>; isLayoutMode: Selector<...>; config: Selector<...>; node: Selector<...>; rawNode: Selector<...>; }'.
121 const mapStateToProps = createStructuredSelector({
~
122 isPreviewMode,
~~~~~~~~~~~~~~~~
...
130 rawNode: (state: RootState, props: NodeProps) => () => node(state, props),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131 });
~
packages/core/src/components/Editable/Inner/index.tsx:105:56 - error TS2345: Argument of type 'Pick<ContentPluginProps<any>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | ... 10 more ... | "createInitialState"> | Pick<...>' is not assignable to parameter of type 'Pick<LayoutPluginProps<any>, "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | "unserialize" | "description" | "handleRemoveHotKey" | ... 7 more ... | "createInitialChildren">'.
Type 'Pick<ContentPluginProps<any>, "allowInlineNeighbours" | "isInlineable" | "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | ... 9 more ... | "createInitialState">' is not assignable to type 'Pick<LayoutPluginProps<any>, "Component" | "name" | "version" | "IconComponent" | "hideInMenu" | "text" | "serialize" | "unserialize" | "description" | "handleRemoveHotKey" | ... 7 more ... | "createInitialChildren">'.
Types of property 'Component' are incompatible.
Type '(ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)' is not assignable to type '(ComponentClass<LayoutPluginProps<any>, any> & ComponentClass<PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>' is not assignable to type '(ComponentClass<LayoutPluginProps<any>, any> & ComponentClass<PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<...>, any>) | (ComponentClass<...> & FunctionComponent<...>) | (FunctionComponent<...> & ComponentClass<...>) | (FunctionComponent<...> & FunctionComponent<...>)'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>' is not assignable to type 'ComponentClass<LayoutPluginProps<any>, any> & ComponentClass<PluginProps<any, LayoutPluginExtraProps<any>> & LayoutPluginExtraProps<...>, any>'.
Type 'ComponentClass<ContentPluginProps<any>, any> & ComponentClass<PluginProps<any, ContentPluginExtraProps<any>> & ContentPluginExtraProps<...>, any>' is not assignable to type 'ComponentClass<LayoutPluginProps<any>, any>'.
105 this.props.createFallbackCell(new LayoutPlugin(defaultPlugin), id);
~~~~~~~~~~~~~
To repro:
yarn
tsc -b -f packages