nuxt/framework

Cannot find name 'useLazyAsyncData'

ohuu opened this issue · 1 comments

ohuu commented

I'm using Nuxt Bridge with typescript. Calling useLazyAsyncData works fine (it builds without error and everything works) but vscode can't find the function so I have no intellisense.

<script lang="ts" setup>
interface Users {
  data: [{ email: string }];
}

const getUsers = (): Promise<Users> =>
  fetch("https://reqres.in/api/users?page=2")
    .then((res) => res.json())
    .then((res) => res as Users);

const { data } = useLazyAsyncData("users", getUsers);
</script>

according to vscode data has type any because useLazyAsyncData can't be found (it has a red squiggly under it). Can I explicitly import this function from somewhere?

Have you set up your tsconfig.json as suggested in the docs?