Skip to content

Commit

Permalink
fix: type (resolve #12030) (#12034)
Browse files Browse the repository at this point in the history
* fix: type (resolve #12030)

* chore: revert layout change

* chore: use import source

* chore: ...
  • Loading branch information
fz6m authored Jan 10, 2024
1 parent 41f1908 commit f6af8de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/plugins/src/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function accessProvider(container) {
content: `
import React, { PropsWithChildren } from 'react';
import { AccessContext } from './context';
import type { IRoute } from 'umi';
import type { IRoute } from '${api.appData.umi.importSource}';
export const useAccess = () => {
return React.useContext(AccessContext);
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/src/dva.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export { getDvaApp } from './dva';
api.writeTmpFile({
path: 'types.d.ts',
tpl: `
import type { History } from 'umi';
import type { History } from '${api.appData.umi.importSource}';
export interface ConnectProps {
dispatch?: Dispatch;
Expand Down
8 changes: 5 additions & 3 deletions packages/plugins/src/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ ${isFlattedDepsDir ? '/// <reference types="antd" />' : ''}
path: 'Layout.tsx',
content: `
${PKG_TYPE_REFERENCE}
import { Link, useLocation, useNavigate, Outlet, useAppData, useRouteData, matchRoutes } from 'umi';
import type { IRoute } from 'umi';
import {
Link, useLocation, useNavigate, Outlet, useAppData, matchRoutes,
type IRoute
} from '${api.appData.umi.importSource}';
import React, { useMemo } from 'react';
import {
ProLayout,
Expand Down Expand Up @@ -741,7 +743,7 @@ export default LogoIcon;
path: 'Exception.tsx',
content: `
import React from 'react';
import { history, type IRoute } from 'umi';
import { history, type IRoute } from '${api.appData.umi.importSource}';
import { Result, Button } from 'antd';
const Exception: React.FC<{
Expand Down

0 comments on commit f6af8de

Please sign in to comment.