Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): Vue default option type #12663

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions types/test/augmentation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const vm = new Vue({

vm.$instanceProperty
vm.$instanceMethod()
vm.$root.$children[0].$children[0]

Vue.staticProperty
Vue.staticMethod()
Expand Down
14 changes: 7 additions & 7 deletions types/vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ export interface CreateElement {
export interface Vue<
Data = Record<string, any>,
Props = Record<string, any>,
Parent = never,
Root = never,
Children = never,
Options = never,
Parent = unknown,
Root = unknown,
Children = unknown,
Options = unknown,
Emit = (event: string, ...args: any[]) => Vue
> {
// properties with different types in defineComponent()
readonly $data: Data
readonly $props: Props
readonly $parent: Parent extends never ? Vue : Parent
readonly $root: Root extends never ? Vue : Root
readonly $children: Children extends never ? Vue[] : Children
readonly $parent: Parent extends unknown ? Vue : Parent
readonly $root: Root extends unknown ? Vue : Root
readonly $children: Children extends unknown ? Vue[] : Children
readonly $options: ComponentOptions<Vue>
$emit: Emit

Expand Down