Skip to content

Commit

Permalink
fix(ts): should export original theme object
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Oct 18, 2023
1 parent 358fcd2 commit 13033b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 2 additions & 4 deletions packages/design/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { theme } from 'antd';

// 引入 antd/dist/reset.css,以重置基本样式,保证原生元素遵从 antd 规范样式
// ref: https://ant.design/docs/react/migration-v5-cn#%E6%8A%80%E6%9C%AF%E8%B0%83%E6%95%B4
import 'antd/dist/reset.css';
Expand All @@ -25,9 +23,9 @@ export { default as Breadcrumb } from './breadcrumb';
export { default as Spin } from './spin';
export { default as Badge } from './badge';

const { useToken } = theme;
import theme from './theme';

// 直接导出 useToken,方便上层使用
const { useToken } = theme;
export { useToken };

export type { PresetStatusColorType } from 'antd/es/_util/colors';
15 changes: 7 additions & 8 deletions packages/design/src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ const defaultSeed = {
const defaultConfig = theme.defaultConfig;
defaultConfig.token = defaultSeed;

export default {
...theme,
defaultSeed,
defaultConfig,
components: {
InputNumber: {
handleVisible: true as true,
},
theme.defaultSeed = defaultSeed;
theme.defaultConfig = defaultConfig;
(theme as any).components = {
InputNumber: {
handleVisible: true as true,
},
};

export default theme;
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"esModuleInterop": true,
"types": ["jest", "node", "@ant-design/cssinjs"],
"types": ["jest", "node"],
"declaration": true,
// TS 编译时跳过对 node_modules 依赖的检查
"skipLibCheck": true,
"resolveJsonModule": true,
"baseUrl": "./",
"paths": {
// ref: https://github.com/microsoft/TypeScript/issues/29808#issuecomment-540292885
"@ant-design/cssinjs": ["node_modules/@ant-design/cssinjs"],
"@@/*": [".dumi/tmp/*"],
"@oceanbase/design": ["packages/design/src/index.ts"],
"@oceanbase/design/es/*": ["packages/design/src/*"],
Expand Down

0 comments on commit 13033b1

Please sign in to comment.