Skip to content

Commit 167481a

Browse files
committed
reproduce
1 parent ee548ac commit 167481a

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"@types/node": "22.13.9",
1414
"eslint": "9.21.0",
1515
"eslint-plugin-vue": "10.0.0",
16-
"jiti": "~2.4.2",
16+
"jiti": "2.4.2",
17+
"typescript": "5.8.2",
1718
"typescript-eslint": "8.26.0",
1819
"vue": "3.5.13",
1920
"vue-eslint-parser": "10.1.0"

src/Component.vue

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
<script lang="ts">
2-
export type ComponentProps<
3-
TValueLoooooooooooooooooooooooooooooooooog = string
4-
> = {
5-
value?: TValueLoooooooooooooooooooooooooooooooooog;
6-
};
2+
export type WuiFilterEditorListOption<
3+
TValue = string,
4+
TValueKey extends string = "value"
5+
> = Record<TValueKey, TValue> & Partial<Record<string, unknown>>;
6+
7+
export interface WuiFilterEditorListProps<
8+
TValue = string,
9+
TValueKey extends string = "value"
10+
> {
11+
valueField?: TValueKey;
12+
options: Array<WuiFilterEditorListOption<TValue, TValueKey>>;
13+
}
714
</script>
815

916
<script
1017
setup
1118
lang="ts"
12-
generic="TValueLoooooooooooooooooooooooooooooooooog = string"
19+
generic="TValue = string, TValueKey extends string = 'value'"
1320
>
1421
const props = withDefaults(
15-
defineProps<ComponentProps<TValueLoooooooooooooooooooooooooooooooooog>>(),
22+
defineProps<WuiFilterEditorListProps<TValue, TValueKey>>(),
1623
{
17-
value: "default",
24+
// @ts-expect-error: default is compatible with generic default
25+
valueField: "value",
1826
}
1927
);
20-
</script>
2128
22-
<template>
23-
<span>{{ props.value }}</span>
24-
</template>
29+
console.log(props);
30+
</script>

0 commit comments

Comments
 (0)