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

[TypeScript] Imported refs can't be used as template refs in development #7567

Closed
ferferga opened this issue Jan 22, 2023 · 0 comments · Fixed by #7593
Closed

[TypeScript] Imported refs can't be used as template refs in development #7567

ferferga opened this issue Jan 22, 2023 · 0 comments · Fixed by #7593

Comments

@ferferga
Copy link
Contributor

ferferga commented Jan 22, 2023

Vue version

3.2.39 (but also reproducible in latest as the time of writing, 3.2.45)

Link to minimal reproduction

https://sfc.vuejs.org/#__DEV__eNp9UctOwzAQ/JWVL2mlxJboiZBW5YDEAS6Ioy8h2baB+CF7kyJV+XfspGpDkTjuzM7Menxij9byvkOWs8JXrrEEHqmzG6kbZY0jOAG2qFDTG+5ggJ0zChIuCD1x8onUhZiEQRIGQmXbkjBMAEXd9OBwt5bsaiIZiMAWweK8ylI2hWWqtPzTGx3OOUUDeSa8ZDmMSMTCvXGW7EBkfS5Ep+3XnldGiW3ghOs0NQqz2qjtit/x1b2oG09znKNX2YczR48uJEqWzsxFAHt0mUNdo0P3b9jN7q/AG+5PaMwcpB5CAec+w8MvvYfiUjiWVB0uvYfA5CH2jN/jUmW0p/kHraOqeH5/fXmawM1iOQpGn8V1M4XFEtabqdRoY1rkrdkvkplbX7YdQnUo9R7rPElnSXzkovewZMMP/SnKPA==

Steps to reproduce

Open the browser's console. In every step, check how the message elementRef value changed from the watcher in test.ts is displayed

  • Change between production and development. You will see that it works as expected and the message is still displayed when reloading the page
  • Add lang="ts" to the <script setup> tag.
  • Change between dev and production. Production works without any problem, but development doesn't.

The same behaviour is reproducible across both mentioned Vue versions.

What is expected?

Refs imported from other modules should be binded to template refs

What is actually happening?

The ref is not binded to the template one in development when using lang=ts.

System Info

No response

Any additional comments?

As @jacekkarczmarczyk pointed out:

Without lang it generates:
const __returned__ = { get elementRef() { return elementRef } }

With lang:
const __returned__ = { }

Full Discord discussion starts here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants