Skip to content

Commit 12f3bed

Browse files
author
yuuangzhang
committed
feat: upgrade typescript to v5
1 parent 1b32cc4 commit 12f3bed

File tree

19 files changed

+169
-142
lines changed

19 files changed

+169
-142
lines changed

docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"ssr-plugin-midway": "^6.0.0",
3838
"ssr-plugin-vue3": "^6.0.0",
3939
"ssr-types": "^6.0.0",
40-
"typescript": "^4.0.0"
40+
"typescript": "^5.0.0"
4141
},
4242
"scripts": {
4343
"stop": "egg-scripts stop --title=midway-server-my_midway_project",

docs/web/markdown/features/vite.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ const __vite_ssr_import_0__ = await __vite_ssr_import__("semver");
206206
"ssr": "^5.0.0",
207207
"ssr-plugin-midway": "^5.0.0",
208208
"ssr-plugin-vue3": "^5.0.0",
209-
"typescript": "^4.0.0"
209+
"typescript": "^5.0.0"
210210
},
211211
```
212212
- 删除原有的 `vite.config.js` 文件,如之前没有创建,则不需要删除

example/midway-react-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"ssr-plugin-midway": "^6.0.0",
2929
"ssr-plugin-react": "^6.0.0",
3030
"ssr-types": "^6.0.0",
31-
"typescript": "^4.0.0"
31+
"typescript": "^5.0.0"
3232
},
3333
"scripts": {
3434
"prod": "ssr build && pm2 start pm2.config.js",

example/midway-react18-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"ssr-plugin-midway": "^6.0.0",
2828
"ssr-plugin-react18": "^6.0.0",
2929
"ssr-types": "^6.0.0",
30-
"typescript": "^4.0.0"
30+
"typescript": "^5.0.0"
3131
},
3232
"scripts": {
3333
"prod": "ssr build && pm2 start pm2.config.js",

example/midway-vue-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"ssr-plugin-midway": "^6.0.0",
2929
"ssr-plugin-vue": "^6.0.0",
3030
"ssr-types": "^6.0.0",
31-
"typescript": "^4.0.0"
31+
"typescript": "^5.0.0"
3232
},
3333
"scripts": {
3434
"prod": "ssr build && pm2 start pm2.config.js",

example/midway-vue3-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"ssr-plugin-midway": "^6.0.0",
2929
"ssr-plugin-vue3": "^6.0.0",
3030
"ssr-types": "^6.0.0",
31-
"typescript": "^4.0.0"
31+
"typescript": "^5.0.0"
3232
},
3333
"scripts": {
3434
"prod": "ssr build && pm2 start pm2.config.js",

example/midway-vue3-ssr/web/shims-vue.d.ts

-8
This file was deleted.

example/nestjs-react-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ssr-plugin-nestjs": "^6.0.0",
2727
"ssr-plugin-react": "^6.0.0",
2828
"ssr-types": "^6.0.0",
29-
"typescript": "^4.0.0",
29+
"typescript": "^5.0.0",
3030
"webpack": "^4.0.0"
3131
},
3232
"engines": {

example/nestjs-react18-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"ssr-plugin-nestjs": "^6.0.0",
2626
"ssr-plugin-react18": "^6.0.0",
2727
"ssr-types": "^6.0.0",
28-
"typescript": "^4.0.0",
28+
"typescript": "^5.0.0",
2929
"webpack": "^4.0.0"
3030
},
3131
"engines": {

example/nestjs-vue-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"ssr-plugin-nestjs": "^6.0.0",
2525
"ssr-plugin-vue": "^6.0.0",
2626
"ssr-types": "^6.0.0",
27-
"typescript": "^4.0.0",
27+
"typescript": "^5.0.0",
2828
"webpack": "^4.0.0"
2929
},
3030
"engines": {

example/nestjs-vue3-ssr-pinia/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"ssr-plugin-nestjs": "^6.0.0",
2626
"ssr-plugin-vue3": "^6.0.0",
2727
"ssr-types": "^6.0.0",
28-
"typescript": "^4.0.0",
28+
"typescript": "^5.0.0",
2929
"webpack": "^4.0.0"
3030
},
3131
"engines": {

example/nestjs-vue3-ssr/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"ssr-plugin-nestjs": "^6.0.0",
2626
"ssr-plugin-vue3": "^6.0.0",
2727
"ssr-types": "^6.0.0",
28-
"typescript": "^4.0.0",
28+
"typescript": "^5.0.0",
2929
"webpack": "^4.0.0"
3030
},
3131
"engines": {

example/nestjs-vue3-ssr/web/shims-vue.d.ts

-8
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@
8080
"semver": "^7.3.7",
8181
"shelljs": "^0.8.5",
8282
"turbo": "^1.4.3",
83-
"typescript": "^4.7.4"
83+
"typescript": "^5.0.0"
8484
}
8585
}

packages/hoc-react/src/wrapComponent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const fetchAndDispatch = async ({ fetch, layoutFetch }: fetchType, dispatch: Rea
3333
function wrapComponent(WrappedComponent: DynamicFC | StaticFC) {
3434
return withRouter((props: any) => {
3535
const [ready, setReady] = useState(WrappedComponent.name !== 'dynamicComponent')
36-
const { state, dispatch } = useContext(useStoreContext() as any)
36+
const { state, dispatch } = useContext<any>(useStoreContext() as any)
3737

3838
useEffect(() => {
3939
didMount()

packages/hoc-react18/src/wrapComponent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const fetchAndDispatch = async ({ fetch, layoutFetch }: fetchType, dispatch: Rea
3333
function wrapComponent(WrappedComponent: DynamicFC | StaticFC) {
3434
return withRouter((props: any) => {
3535
const [ready, setReady] = useState(WrappedComponent.name !== 'dynamicComponent')
36-
const { state, dispatch } = useContext(useStoreContext() as any)
36+
const { state, dispatch } = useContext<any>(useStoreContext() as any)
3737

3838
useEffect(() => {
3939
didMount()

packages/plugin-vue/src/entry/server-entry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const serverRender = async (ctx: ISSRContext, config: IConfig) => {
5454
const state = Object.assign({}, store.state ?? {}, combineAysncData)
5555
const ssrDevInfo = { manifest: isDev ? manifest : '', rootId }
5656
const app = new RealVue({
57-
// @ts-expect-error
57+
// @ts-ignore
5858
router,
5959
store,
6060
render: function (h: Vue.CreateElement) {

packages/types/src/react/route.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ export interface ProvisionalFeRouteItem {
2222
component?: string
2323
}
2424

25-
export interface Params<T, U> {
25+
export interface Params<T, U extends { [K in keyof U]?: string | undefined }> {
2626
ctx?: ISSRContext<T>
2727
routerProps?: RouteComponentProps<U>
2828
state?: any
2929
}
30-
export interface ParamsMidway<T, U> {
30+
export interface ParamsMidway<T, U extends { [K in keyof U]?: string | undefined }> {
3131
ctx?: ISSRMidwayContext<T>
3232
routerProps?: RouteComponentProps<U>
3333
state?: any
3434
}
35-
export interface ParamsMidwayKoa<T, U> {
35+
export interface ParamsMidwayKoa<T, U extends { [K in keyof U]?: string | undefined }> {
3636
ctx?: ISSRMidwayKoaContext<T>
3737
routerProps?: RouteComponentProps<U>
3838
state?: any
3939
}
40-
export interface ParamsNest<T, U> {
40+
export interface ParamsNest<T, U extends { [K in keyof U]?: string | undefined }> {
4141
ctx?: ISSRNestContext<T>
4242
routerProps?: RouteComponentProps<U>
4343
state?: any
4444
}
4545

46-
export type ReactFetch<T={}, U={}> = (params: Params<T, U>) => Promise<any>
47-
export type ReactMidwayFetch<T={}, U={}> = (params: ParamsMidway<T, U>) => Promise<any>
48-
export type ReactMidwayKoaFetch<T={}, U={}> = (params: ParamsMidwayKoa<T, U>) => Promise<any>
49-
export type ReactNestFetch<T={}, U={}> = (params: ParamsNest<T, U>) => Promise<any>
46+
export type ReactFetch<T={}, U extends { [K in keyof U]?: string | undefined } = {}> = (params: Params<T, U>) => Promise<any>
47+
export type ReactMidwayFetch<T={}, U extends { [K in keyof U]?: string | undefined } = {}> = (params: ParamsMidway<T, U>) => Promise<any>
48+
export type ReactMidwayKoaFetch<T={}, U extends { [K in keyof U]?: string | undefined } = {}> = (params: ParamsMidwayKoa<T, U>) => Promise<any>
49+
export type ReactNestFetch<T={}, U extends { [K in keyof U]?: string | undefined } = {}> = (params: ParamsNest<T, U>) => Promise<any>
5050

5151
export type ReactESMFetch = () => Promise<{
5252
default: ReactFetch

0 commit comments

Comments
 (0)