Skip to content

Commit 4cbc64e

Browse files
Update docs on usage of external types in defineProps (#2600)
* Update composition-api.md Add documentation for when types for `defineProps` are coming from an external file * Update composition-api.md * Update composition-api.md
1 parent 7d08ac3 commit 4cbc64e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/guide/typescript/composition-api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ const props = defineProps<Props>()
5050
</script>
5151
```
5252

53+
This also works if `Props` is imported from an external source. This feature requires TypeScript to be a peer dependency of Vue.
54+
55+
```vue
56+
<script setup lang="ts">
57+
import type { Props } from './foo'
58+
59+
const props = defineProps<Props>()
60+
</script>
61+
```
62+
5363
#### Syntax Limitations {#syntax-limitations}
5464

5565
In version 3.2 and below, the generic type parameter for `defineProps()` were limited to a type literal or a reference to a local interface.

0 commit comments

Comments
 (0)