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

feat(types): ComponentInstance type #5408

Merged
merged 4 commits into from
Dec 8, 2023

Conversation

pikax
Copy link
Member

@pikax pikax commented Feb 11, 2022

Type to replace the InstanceType<typeof MyComp>

The advantages of using this type, is to also allow other valid typed components to be resolved, because the InstanceType, relies on the Constructor type.

// plain objects should be supported too, this won't work with `InstanceType`
const CompObjectSetup = {
  props: {
    test: String
  },
  setup() {
    return {
      a: 1
    }
  }
}
declare const compObjectSetup: ComponentInstance<typeof CompObjectSetup>
expectType<string | undefined>(compObjectSetup.test)
expectType<number>(compObjectSetup.a)
expectType<ComponentPublicInstance>(compObjectSetup)

@netlify
Copy link

netlify bot commented Feb 11, 2022

Deploy Preview for vue-next-template-explorer ready!

Name Link
🔨 Latest commit 05cea29
🔍 Latest deploy log https://app.netlify.com/sites/vue-next-template-explorer/deploys/6274e49ac25ca800083f1923
😎 Deploy Preview https://deploy-preview-5408--vue-next-template-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 11, 2022

Deploy Preview for vue-sfc-playground ready!

Name Link
🔨 Latest commit 05cea29
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/6274e49acbbf8d0008bd2e97
😎 Deploy Preview https://deploy-preview-5408--vue-sfc-playground.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 11, 2022

Deploy Preview for vuejs-coverage ready!

Name Link
🔨 Latest commit 05cea29
🔍 Latest deploy log https://app.netlify.com/sites/vuejs-coverage/deploys/6274e49a6a3cc90008d3b306
😎 Deploy Preview https://deploy-preview-5408--vuejs-coverage.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@pikax pikax added 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. scope: types labels Feb 11, 2022
@yyx990803 yyx990803 added the ready to merge The PR is ready to be merged. label May 6, 2022
@yyx990803
Copy link
Member

This is technically a feature so grouping it under 3.3 for now

# Conflicts:
#	packages/dts-test/componentInstance.test-d.tsx
#	packages/dts-test/defineComponent.test-d.tsx
@github-actions
Copy link

github-actions bot commented Oct 6, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.6 kB 29.5 kB
vue.global.prod.js 132 kB 49.3 kB 44.4 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 19.9 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

@sxzz sxzz changed the base branch from main to minor October 6, 2023 15:26
@sxzz sxzz force-pushed the minor branch 4 times, most recently from 5d93a55 to 06ad749 Compare October 20, 2023 09:35
@yyx990803 yyx990803 changed the title types(runtime-core): ComponentInstance type feat(types): ComponentInstance type Oct 23, 2023
@yyx990803 yyx990803 merged commit bfb8565 into vuejs:minor Dec 8, 2023
11 checks passed
@pikax pikax deleted the types/ComponentInstance branch December 21, 2023 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready to merge The PR is ready to be merged. scope: types version: minor
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants