Skip to content

UseAsyncQuery fails to get correct type on res data #632

Description

@wrzrmzx

Environment

  • Operating System: Darwin
  • Node Version: v20.15.0
  • Nuxt Version: 3.12.4
  • CLI Version: 3.12.0
  • Nitro Version: 2.9.7
  • Package Manager: pnpm@9.5.0
  • Builder: -
  • User Config: features, modules, typescript, imports, appConfig, app, nitro, apollo, i18n, vueuse, unocss, postcss, headlessui, compatibilityDate
  • Runtime Modules: @nuxtjs/i18n@8.3.3, @nuxtjs/apollo@5.0.0-alpha.11, @pinia/nuxt@0.5.2, @vueuse/nuxt@10.11.0, @unocss/nuxt@0.61.7, nuxt-headlessui@1.2.0
  • Build Modules: -

Describe the bug

After I update the deps using pnpm up -Lir, I got wrong type in data:
const { data } = await useAsyncQuery<Query>()
vscode shows: const data: AsyncData<T, Error> rather than ListNotificationGqlResult(a type in Query)
so that I got wrong in const listNoteCountTypesCommentReply = computed(() =>listUnreadNotificationsCount.value.list.find(item => item.msgtype === 'comment_reply')?.count || 0)
for item gets any type

Expected behaviour

type of data mentioned above is ListNotificationGqlResult

Reproduction

https://github.com/PatchyVideo/platinum/blob/nuxt/pages/notification.vue#L32 type of data cannot be infered as ListNotificationGqlResult
while history version
https://github.com/PatchyVideo/platinum/blob/a29204bc08f402dff7f625802a8b51a3e651b34d/pages/notification.vue#L32 can infer it correctly

Additional context

plugin GraphQL v0.1.2 and Apollo GraphQL v1.20.0 is installed in my vscode

Logs

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions