Skip to content

Commit ba543b5

Browse files
committed
fix(type): fix types issue
1 parent 1929287 commit ba543b5

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"prettier",
1212
"eslint:recommended",
1313
"plugin:@typescript-eslint/eslint-recommended",
14-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
1514
"plugin:@typescript-eslint/recommended"
1615
],
1716
"globals": {
@@ -47,6 +46,7 @@
4746
"react/prop-types": 0,
4847
"no-await-in-loop": "off",
4948
"no-restricted-syntax": "off",
49+
"arrow-body-style": "off",
5050
"import/no-extraneous-dependencies": [
5151
"error",
5252
{

packages/reactant-ssr/src/createServerApp.tsx

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
import React, { FunctionComponent } from 'react';
1+
import React from 'react';
2+
import type { FunctionComponent } from 'react';
23
import { AppProps } from 'next/app';
3-
import { createApp as createAppWithoutSSR, Renderer } from 'reactant';
4+
import { createApp as createBaseApp } from 'reactant';
5+
import type { Config, Renderer } from 'reactant';
46
import { AppView } from './appView';
5-
import { ServerConfig, ServerApp } from './interfaces';
7+
import type { ServerConfig, ServerApp } from './interfaces';
68

79
/**
810
* create a ServerApp for SSR
911
*/
1012
export const createServerApp = <T, S extends any[], R extends Renderer<S>>(
1113
options: ServerConfig<T, S, R>
1214
): ServerApp<T, S, R> => {
13-
const {
14-
bootstrap,
15-
store,
16-
instance,
17-
container,
18-
modules,
19-
} = createAppWithoutSSR({
15+
const { bootstrap, store, instance, container, modules } = createBaseApp({
2016
...options,
21-
// TODO: fix types
22-
// @ts-ignore
23-
main: options.main ?? AppView,
17+
main: options.main ?? (AppView as Config<T, S, R>['main']),
2418
render: (element) => element,
2519
});
2620
const AppComponent = (appProps: AppProps) => {
27-
return bootstrap((Component: FunctionComponent<AppProps>) => (
21+
return (bootstrap as (
22+
Component: FunctionComponent<any>
23+
) => JSX.Element)((Component: FunctionComponent<AppProps>) => (
2824
<Component {...appProps} />
2925
)) as JSX.Element;
3026
};

0 commit comments

Comments
 (0)