@@ -23,12 +23,13 @@ Support these syntaxes:
2323
2424### 1. local variable/function/class
2525
26- ``` vue
26+ ``` vue twoslash
2727<script setup lang="ts">
2828export const foo: string = 'foo',
2929 bar = 10
3030export let baz: string | undefined
3131export var qux = fn()
32+ // @errors: 2448 2454 2695
3233export const { a, b, c } = { a: 1, b: 2, c: 3 }
3334
3435export function fn() {}
@@ -38,8 +39,8 @@ export class A {}
3839
3940::: details Compiled Code
4041
41- ``` vue
42- <script lang="ts">
42+ ``` vue twoslash
43+ <script setup lang="ts">
4344const foo: string = 'foo',
4445 bar = 10
4546let baz: string | undefined
@@ -67,16 +68,20 @@ defineExpose({
6768
6869### 2. export with alias
6970
70- ``` vue
71+ ``` vue twoslash
7172<script setup lang="ts">
73+ const foo = ''
74+
7275export { foo as foo1 }
7376</script>
7477```
7578
7679::: details Compiled Code
7780
78- ``` vue
81+ ``` vue twoslash
7982<script setup lang="ts">
83+ const foo = 'foo'
84+
8085defineExpose({
8186 foo1: foo,
8287})
@@ -87,16 +92,35 @@ defineExpose({
8792
8893### 3. export from other file
8994
90- ``` vue
95+ ::: code-group
96+
97+ ``` vue [App.vue] twoslash
9198<script setup lang="ts">
99+ // #region export-file
100+ const foo = 'foo'
101+ type Foo = string
102+
103+ export { type Foo, foo }
104+ // #endregion export-file
105+ // ---cut---
106+ // @noErrors
92107export { foo, type Foo, foo as bar } from './types'
93108</script>
94109```
95110
111+ <<< ./export-expose.md#export-file{ts} [ types.ts]
112+
113+ :::
114+
96115::: details Compiled Code
97116
98- ``` vue
117+ ``` vue twoslash
99118<script setup lang="ts">
119+ const __MACROS_expose_0 = 'foo'
120+ const __MACROS_expose_1 = 'foo'
121+ type Foo = string
122+ // ---cut---
123+ // @noErrors
100124import {
101125 type Foo,
102126 foo as __MACROS_expose_0,
@@ -113,16 +137,32 @@ defineExpose({
113137
114138### 4. namespace export
115139
116- ``` vue
140+ ::: code-group
141+
142+ ``` vue [App.vue] twoslash
117143<script setup lang="ts">
144+ const foo = { foo: 'foo' }
145+ // ---cut---
146+ // @noErrors
118147export * as foo from './types'
119148</script>
120149```
121150
151+ ``` ts [types.ts]
152+ export const foo = ' foo'
153+ ```
154+
155+ :::
156+
122157::: details Compiled Code
123158
124- ``` vue
159+ ``` vue twoslash
125160<script setup lang="ts">
161+ const __MACROS_expose_0 = {
162+ foo: 'foo',
163+ }
164+ // ---cut---
165+ // @noErrors
126166import * as __MACROS_expose_0 from './types'
127167defineExpose({
128168 foo: __MACROS_expose_0,
0 commit comments