Skip to content

Commit

Permalink
feat: upgrade typescript to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuangzhang committed Oct 22, 2024
1 parent 1b32cc4 commit 12f3bed
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 142 deletions.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-vue3": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"scripts": {
"stop": "egg-scripts stop --title=midway-server-my_midway_project",
Expand Down
2 changes: 1 addition & 1 deletion docs/web/markdown/features/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ const __vite_ssr_import_0__ = await __vite_ssr_import__("semver");
"ssr": "^5.0.0",
"ssr-plugin-midway": "^5.0.0",
"ssr-plugin-vue3": "^5.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
```
- 删除原有的 `vite.config.js` 文件,如之前没有创建,则不需要删除
Expand Down
2 changes: 1 addition & 1 deletion example/midway-react-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-react": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"scripts": {
"prod": "ssr build && pm2 start pm2.config.js",
Expand Down
2 changes: 1 addition & 1 deletion example/midway-react18-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-react18": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"scripts": {
"prod": "ssr build && pm2 start pm2.config.js",
Expand Down
2 changes: 1 addition & 1 deletion example/midway-vue-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-vue": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"scripts": {
"prod": "ssr build && pm2 start pm2.config.js",
Expand Down
2 changes: 1 addition & 1 deletion example/midway-vue3-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"ssr-plugin-midway": "^6.0.0",
"ssr-plugin-vue3": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0"
"typescript": "^5.0.0"
},
"scripts": {
"prod": "ssr build && pm2 start pm2.config.js",
Expand Down
8 changes: 0 additions & 8 deletions example/midway-vue3-ssr/web/shims-vue.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion example/nestjs-react-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"ssr-plugin-nestjs": "^6.0.0",
"ssr-plugin-react": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"webpack": "^4.0.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion example/nestjs-react18-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"ssr-plugin-nestjs": "^6.0.0",
"ssr-plugin-react18": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"webpack": "^4.0.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion example/nestjs-vue-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ssr-plugin-nestjs": "^6.0.0",
"ssr-plugin-vue": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"webpack": "^4.0.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion example/nestjs-vue3-ssr-pinia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"ssr-plugin-nestjs": "^6.0.0",
"ssr-plugin-vue3": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"webpack": "^4.0.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion example/nestjs-vue3-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"ssr-plugin-nestjs": "^6.0.0",
"ssr-plugin-vue3": "^6.0.0",
"ssr-types": "^6.0.0",
"typescript": "^4.0.0",
"typescript": "^5.0.0",
"webpack": "^4.0.0"
},
"engines": {
Expand Down
8 changes: 0 additions & 8 deletions example/nestjs-vue3-ssr/web/shims-vue.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
"semver": "^7.3.7",
"shelljs": "^0.8.5",
"turbo": "^1.4.3",
"typescript": "^4.7.4"
"typescript": "^5.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/hoc-react/src/wrapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const fetchAndDispatch = async ({ fetch, layoutFetch }: fetchType, dispatch: Rea
function wrapComponent(WrappedComponent: DynamicFC | StaticFC) {
return withRouter((props: any) => {
const [ready, setReady] = useState(WrappedComponent.name !== 'dynamicComponent')
const { state, dispatch } = useContext(useStoreContext() as any)
const { state, dispatch } = useContext<any>(useStoreContext() as any)

useEffect(() => {
didMount()
Expand Down
2 changes: 1 addition & 1 deletion packages/hoc-react18/src/wrapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const fetchAndDispatch = async ({ fetch, layoutFetch }: fetchType, dispatch: Rea
function wrapComponent(WrappedComponent: DynamicFC | StaticFC) {
return withRouter((props: any) => {
const [ready, setReady] = useState(WrappedComponent.name !== 'dynamicComponent')
const { state, dispatch } = useContext(useStoreContext() as any)
const { state, dispatch } = useContext<any>(useStoreContext() as any)

useEffect(() => {
didMount()
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-vue/src/entry/server-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const serverRender = async (ctx: ISSRContext, config: IConfig) => {
const state = Object.assign({}, store.state ?? {}, combineAysncData)
const ssrDevInfo = { manifest: isDev ? manifest : '', rootId }
const app = new RealVue({
// @ts-expect-error
// @ts-ignore
router,
store,
render: function (h: Vue.CreateElement) {
Expand Down
16 changes: 8 additions & 8 deletions packages/types/src/react/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@ export interface ProvisionalFeRouteItem {
component?: string
}

export interface Params<T, U> {
export interface Params<T, U extends { [K in keyof U]?: string | undefined }> {
ctx?: ISSRContext<T>
routerProps?: RouteComponentProps<U>
state?: any
}
export interface ParamsMidway<T, U> {
export interface ParamsMidway<T, U extends { [K in keyof U]?: string | undefined }> {
ctx?: ISSRMidwayContext<T>
routerProps?: RouteComponentProps<U>
state?: any
}
export interface ParamsMidwayKoa<T, U> {
export interface ParamsMidwayKoa<T, U extends { [K in keyof U]?: string | undefined }> {
ctx?: ISSRMidwayKoaContext<T>
routerProps?: RouteComponentProps<U>
state?: any
}
export interface ParamsNest<T, U> {
export interface ParamsNest<T, U extends { [K in keyof U]?: string | undefined }> {
ctx?: ISSRNestContext<T>
routerProps?: RouteComponentProps<U>
state?: any
}

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

export type ReactESMFetch = () => Promise<{
default: ReactFetch
Expand Down
Loading

0 comments on commit 12f3bed

Please sign in to comment.