Git Product home page Git Product logo

Comments (8)

lmc3s3f0r avatar lmc3s3f0r commented on September 20, 2024 1

Hi @manniL . I'm the guy who wrote the comment in YouTube about this issue. Thanks for taking the time to report this issue. I have like 68 error messages like this in my project since I updated from 3.8.2 to 3.9.3 and have no clue on how to get rid of them ^_^U

from nuxt.

danielroe avatar danielroe commented on September 20, 2024 1

This appears to be an issue just with pick as transform works fine (FWIW):

const { data } = useAsyncData(() => Promise.resolve({ data: { test: 1 } }), {
  pick: ['data'],
  // transform: data => data.data,
})
const test = computed(() => data.value?.test)

Looking to reproduce, this code (with pick) has a type error all the way back to at least v3.6.0 in the Nuxt playground.

from nuxt.

happy-turtle avatar happy-turtle commented on September 20, 2024

I am not 100% sure if this applies to this issue. But I was able to resolve type errors in our project by explicitly pinning "vue": "3.4.15" after upgrading Nuxt to 3.9.x.

from nuxt.

stackblitz avatar stackblitz commented on September 20, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from nuxt.

manniL avatar manniL commented on September 20, 2024

@danielroe Attached a repro (that I wanted to put there before, sorry) also showing transform issues I think.

from nuxt.

lmc3s3f0r avatar lmc3s3f0r commented on September 20, 2024

Would there be no way of having the useFetch return a globalThis.Ref (without using transform or pick) instead of Ref like before?

from nuxt.

aaharu avatar aaharu commented on September 20, 2024

https://nuxt.com/docs/getting-started/data-fetching#minimize-payload-size

Is the reproduction code misusing pick?
pick: ['data'] and transform: data => ({ data: data.data }) operate similarly, but repro code seem to be expecting transform: data => data.data.

const { data } = useAsyncData(
  'key',
  async () => {
    return { data: { test: 1 }, foo: 'bar' }
  },
  {
    pick: ['data'],
  },
)

const test = computed(() => data.value?.foo) // Property 'foo' does not exist 
const test = computed(() => data.value?.data.test) // works

from nuxt.

lmc3s3f0r avatar lmc3s3f0r commented on September 20, 2024

I am not 100% sure if this applies to this issue. But I was able to resolve type errors in our project by explicitly pinning "vue": "3.4.15" after upgrading Nuxt to 3.9.x.

Thanks! Pinning Vue 3.4.15 fixed the issue I was having as well.

from nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.