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

vue setup组件的引用的实例类型会提示props相关的类型, 但是实际运行是没有的 #11166

Closed
partiality opened this issue Jun 18, 2024 · 2 comments

Comments

@yangliguo7
Copy link
Contributor

<script setup lang="ts">
import {  onMounted, ref } from 'vue'

const compRef = ref<{x:1}>(undefined)

onMounted(() => {
console.log(compRef.value.x) // 你认为这里应该报错吗?
})
</script>

<template>
  <h1>123{{ compRef }}</h1>
</template>


@Alfred-Skyblue
Copy link
Member

ts类型不会影响运行时结果

@github-actions github-actions bot locked and limited conversation to collaborators Jul 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants