Skip to content

Commit

Permalink
test: format of slots
Browse files Browse the repository at this point in the history
  • Loading branch information
KazariEX committed Feb 13, 2025
1 parent ef38d68 commit 38ec503
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/component-type-helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ import HelloWorld from './HelloWorld.vue'
import type { ComponentProps, ComponentSlots } from 'vue-component-type-helpers'

type Props = ComponentProps<typeof HelloWorld> // { msg: string }
type Slots = ComponentSlots<typeof HelloWorld> // { header(_: { num: number; }): any; footer(_: { str: string; }): any; }
type Slots = ComponentSlots<typeof HelloWorld> // { header?: (props: { num: number; }) => any; footer?: (props: { str: string; }) => any; }
```
10 changes: 5 additions & 5 deletions packages/tsc/tests/__snapshots__/dts.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ type __VLS_PrettifyLocal<T> = {
`;
exports[`vue-tsc-dts > Input: class-slots/component.vue, Output: class-slots/component.vue.d.ts 1`] = `
"import { VNode } from 'vue';
"import type { VNode } from 'vue';
declare const _default: new () => {
$slots: {
default(_: {
default: (props: {
num: number;
}): VNode[];
foo(_: {
}) => VNode[];
foo: (props: {
str: string;
}): VNode[];
}) => VNode[];
};
};
export default _default;
Expand Down
6 changes: 3 additions & 3 deletions test-workspace/component-meta/class-slots/component.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import { VNode } from 'vue';
import type { VNode } from 'vue';
export default {} as new () => {
$slots: {
default(_: { num: number; }): VNode[];
foo(_: { str: string; }): VNode[];
default: (props: { num: number; }) => VNode[];
foo: (props: { str: string; }) => VNode[];
};
};
</script>
2 changes: 1 addition & 1 deletion test-workspace/tsc/passedFixtures/vue3/#2617/main.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
let UntypedComponent: new () => {
$slots: {
default: (_: any) => any
default: (props: any) => any
}
} = {} as any;
</script>
Expand Down
4 changes: 2 additions & 2 deletions test-workspace/tsc/passedFixtures/vue3/#2758/child.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
<script lang="ts" setup generic="T extends Record<string, string>">
defineSlots<
{
[K in `cell:${string}`]?: (_: { value: T[keyof T] }) => any;
[K in `cell:${string}`]?: (props: { value: T[keyof T] }) => any;
} & {
default?: (_: Record<string, any>) => any;
default?: (props: Record<string, any>) => any;
}
>();
</script>
2 changes: 1 addition & 1 deletion test-workspace/tsc/passedFixtures/vue3/slots/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<script lang="ts">
export default {
name: 'Self',
slots: Object as SlotsType<{ foo?: (_: any) => any }>,
slots: Object as SlotsType<{ foo?: (props: any) => any }>,
};
declare const Comp: new <T>(props: { value: T; }) => {
Expand Down

0 comments on commit 38ec503

Please sign in to comment.