Skip to content

Conversation

Ap3rtur3
Copy link
Contributor

@Ap3rtur3 Ap3rtur3 commented Feb 6, 2023

Description of Problem

Typescript and Intellij cannot find exposed methods when using InstanceType for typed template refs:

Screenshot at Feb 06 09-52-17

The methods are exposed inside the Modal like so:

setup(props, { expose }) {
  expose({
    open: () => {},
  });
  // ...
}

Proposed Solution

Use Vue's ComponentPublicInstance instead of InstanceType:

import { ref, ComponentPublicInstance } from 'vue';
const modal = ref<ComponentPublicInstance<typeof MyModal> | null>(null);

@netlify
Copy link

netlify bot commented Feb 6, 2023

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 6147a8b
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/63e0c4390988ac0008605ae8
😎 Deploy Preview https://deploy-preview-2210--vuejs.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.

@NataliaTepluhina NataliaTepluhina merged commit 9c1c4ca into vuejs:main Feb 19, 2023
NataliaTepluhina added a commit that referenced this pull request Feb 19, 2023
NataliaTepluhina added a commit that referenced this pull request Feb 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants