docs (#3331): clarify imported types on defineProps#3348
docs (#3331): clarify imported types on defineProps#3348bencodezen wants to merge 1 commit intomainfrom
Conversation
✅ Deploy Preview for vuejs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Updates the Vue TypeScript docs to clarify how defineProps handles imported prop types, addressing confusion around whether “imported types” includes local project files and dependencies.
Changes:
- Clarifies that
Propscan be imported via relative imports, path aliases, or external dependencies. - Updates
script setupAPI docs to state that imported types can be resolved in dev mode when TypeScript is available. - Minor wording tweaks around the Vue 3.3 limitation resolution note.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/guide/typescript/composition-api.md | Clarifies imported-type sources for defineProps and adjusts wording around 3.3 limitations. |
| src/api/sfc-script-setup.md | Updates dev-mode inference description for imported types and adjusts wording around 3.3 limitations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
|
|
||
| This also works if `Props` is imported from an external source. This feature requires TypeScript to be a peer dependency of Vue. | ||
| This also works if `Props` is imported from another file such as a relative import, a path alias (e.g,. `@/types`), or an external dependency (e.g., `node_modules`). This feature requires TypeScript to be a peer dependency of Vue. |
There was a problem hiding this comment.
Typo in the example punctuation: "(e.g,. @/types)" should be "(e.g., @/types)".
| This also works if `Props` is imported from another file such as a relative import, a path alias (e.g,. `@/types`), or an external dependency (e.g., `node_modules`). This feature requires TypeScript to be a peer dependency of Vue. | |
| This also works if `Props` is imported from another file such as a relative import, a path alias (e.g., `@/types`), or an external dependency (e.g., `node_modules`). This feature requires TypeScript to be a peer dependency of Vue. |
| 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. | ||
|
|
||
| This limitation has been resolved in 3.3. The latest version of Vue supports referencing imported and a limited set of complex types in the type parameter position. However, because the type to runtime conversion is still AST-based, some complex types that require actual type analysis, e.g. conditional types, are not supported. You can use conditional types for the type of a single prop, but not the entire props object. | ||
| This limitation was resolved in 3.3. The latest version of Vue supports referencing imported and a limited set of complex types in the type parameter position. However, because the type to runtime conversion is still AST-based, some complex types that require actual type analysis, e.g. conditional types, are not supported. You can use conditional types for the type of a single prop, but not the entire props object. |
There was a problem hiding this comment.
Grammar issue: "supports referencing imported and a limited set of complex types" is missing a noun after "imported" (likely "imported types"). As written it reads incorrectly.
| - 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. | ||
|
|
||
| This limitation has been resolved in 3.3. The latest version of Vue supports referencing imported and a limited set of complex types in the type parameter position. However, because the type to runtime conversion is still AST-based, some complex types that require actual type analysis, e.g. conditional types, are not supported. You can use conditional types for the type of a single prop, but not the entire props object. | ||
| This limitation was resolved in 3.3. The latest version of Vue supports referencing imported and a limited set of complex types in the type parameter position. However, because the type to runtime conversion is still AST-based, some complex types that require actual type analysis, e.g. conditional types, are not supported. You can use conditional types for the type of a single prop, but not the entire props object. |
There was a problem hiding this comment.
Grammar issue: "supports referencing imported and a limited set of complex types" is missing a noun after "imported" (likely "imported types"). As written it reads incorrectly.
Description of Problem
#3331
Proposed Solution
Add clarifying language on both the composition-api guide as well as the API doc page as well.
Additional Information