Skip to content

asyncDataOptions type doesn't accept watch: false #3383

@rigtigeEmil

Description

@rigtigeEmil

Nuxt's useFetch accepts watch?: MultiWatchSources | false (docs), which is the idiomatic way to disable auto-refetching on reactive param changes.

However, asyncDataOptions is typed as AsyncDataOptions<...> (from nuxt/app), which only has watch?: MultiWatchSources — missing | false. Passing watch: false produces:

Type 'boolean' is not assignable to type '(object | WatchSource<unknown>)[]'

This is because the | false variant lives on Nuxt's UseFetchOptions type but not on AsyncDataOptions, and hey-api uses the latter.

Suggested fix: Extend the type to accept false:

asyncDataOptions?: AsyncDataOptions<...> & { watch?: false };

Workaround: watch: [] compiles and has the same runtime effect, but is less idiomatic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Broken or incorrect behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions