Skip to content

Commit

Permalink
chore: 测试导出类型
Browse files Browse the repository at this point in the history
  • Loading branch information
ckvv committed May 23, 2023
1 parent b1e9208 commit 774b5f4
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion scripts/vite-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export const external = [...baseExternal, ...Object.keys(dependencies ?? [])];
export const rootPath = fileURLToPath(new URL('../', import.meta.url));

export const alias = {
'@': fileURLToPath(new URL('../src', import.meta.url)),
'@/': fileURLToPath(new URL('../src/', import.meta.url)),
};
4 changes: 1 addition & 3 deletions scripts/vite.es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import { alias, external } from './vite-common';
const preserveModulesRoot = 'src';
export default defineConfig({
plugins: [dtsPlugin({
skipDiagnostics: false,
cleanVueFileName: true,
exclude: ['node_modules', 'types.d.ts'],
exclude: ['node_modules', 'components.d.ts'],
}), vue()],
build: {
target: 'esnext',
Expand Down
14 changes: 4 additions & 10 deletions src/components/button/button.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<script setup lang="ts">
import { computed, inject } from 'vue';
import type { ButtonProps } from './types';
// import type { ButtonProps } from '@/components/button/types';
import { buttonInjectionKey } from '@/themes';
import { useSize } from '@/hooks';
import type { ComponentSize, ComponentTheme } from '@/constants';
const props = withDefaults(defineProps<{
size?: ComponentSize
round?: boolean
disabled?: boolean
text?: boolean
outlined?: boolean
raised?: boolean
theme?: ComponentTheme
}>(), {
const props = withDefaults(defineProps<ButtonProps>(), {
theme: 'default',
text: false,
outlined: false,
Expand Down
1 change: 1 addition & 0 deletions src/components/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Button from './button.vue';
import { withInstallComponent } from '@/utils';

export * from './types';
export const VButton = withInstallComponent(Button);
export default VButton;
11 changes: 11 additions & 0 deletions src/components/button/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { ComponentSize, ComponentTheme } from '@/constants';

export interface ButtonProps {
size?: ComponentSize
round?: boolean
disabled?: boolean
text?: boolean
outlined?: boolean
raised?: boolean
theme?: ComponentTheme
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"declaration": true,
"paths": {
"@/*": [
"src/*"
"./src/*"
]
},
"baseUrl": "./"
Expand Down

0 comments on commit 774b5f4

Please sign in to comment.