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

invalid type inference in watch([ref] as const) since 1.4.10 #924

Closed
jacekkarczmarczyk opened this issue Apr 25, 2022 · 0 comments · Fixed by #927
Closed

invalid type inference in watch([ref] as const) since 1.4.10 #924

jacekkarczmarczyk opened this issue Apr 25, 2022 · 0 comments · Fixed by #927

Comments

@jacekkarczmarczyk
Copy link
Contributor

jacekkarczmarczyk commented Apr 25, 2022

edit - I see that as const can be now removed, but shouldn't it still work with as const like it did in previous versions? Also this change was not announced in the release notes or changelog

repro

https://github.com/jacekkarczmarczyk/composition-api-ts-bug

run yarn build

code

<script setup lang="ts">
import { ref, watch } from '@vue/composition-api';

const foo = ref('');
watch([foo] as const, ([foo]) => {
  console.log(foo.length);
})
</script>

error

$ vue-tsc --noEmit && vite build
src/App.vue:6:19 - error TS2339: Property 'length' does not exist on type 'Ref<string>'.

6   console.log(foo.length);
                    ~~~~~~

image

@jacekkarczmarczyk jacekkarczmarczyk changed the title invalid type inference in watch([ref]) since 1.5 invalid type inference in watch([ref]) since 1.4.10 Apr 25, 2022
@jacekkarczmarczyk jacekkarczmarczyk changed the title invalid type inference in watch([ref]) since 1.4.10 invalid type inference in watch([ref] as const) since 1.4.10 Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant