Skip to content

Commit 8f82f23

Browse files
authored
fix(runtime-core): keep options API typing intact when expose is used (#14118)
Fixed: #14117 Fixed: vuejs/language-tools#5069
1 parent 83f6ab6 commit 8f82f23

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

packages-private/dts-test/defineComponent.test-d.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,3 +2107,38 @@ defineComponent({
21072107
expectType<string>(this.$props)
21082108
},
21092109
})
2110+
2111+
// #14117
2112+
defineComponent({
2113+
setup() {
2114+
const setup1 = ref('setup1')
2115+
const setup2 = ref('setup2')
2116+
return { setup1, setup2 }
2117+
},
2118+
data() {
2119+
return {
2120+
data1: 1,
2121+
}
2122+
},
2123+
props: {
2124+
props1: {
2125+
type: String,
2126+
},
2127+
},
2128+
methods: {
2129+
methods1() {
2130+
return `methods1`
2131+
},
2132+
},
2133+
computed: {
2134+
computed1() {
2135+
this.setup1
2136+
this.setup2
2137+
this.data1
2138+
this.props1
2139+
this.methods1()
2140+
return `computed1`
2141+
},
2142+
},
2143+
expose: ['setup1'],
2144+
})

packages/runtime-core/src/apiDefineComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export function defineComponent<
272272
Slots,
273273
LocalComponents,
274274
Directives,
275-
Exposed
275+
string
276276
>
277277
>,
278278
): DefineComponent<

packages/runtime-core/src/componentOptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ export type ComponentOptionsWithoutProps<
11941194
S,
11951195
LC,
11961196
Directives,
1197-
Exposed
1197+
string
11981198
>
11991199
>
12001200

@@ -1256,7 +1256,7 @@ export type ComponentOptionsWithArrayProps<
12561256
S,
12571257
LC,
12581258
Directives,
1259-
Exposed
1259+
string
12601260
>
12611261
>
12621262

0 commit comments

Comments
 (0)