next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Cannot pass an array of tags to `cacheTag` function

Open tomdohnal opened this issue 4 months ago • 0 comments

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/wizardly-breeze-j63t72?file=%2Fapp%2Fpage.tsx%3A6%2C3-6%2C32

To Reproduce

  1. open the page.tsx file
  2. hover over the line with cacheTag(["tag-1", "tag-2"]);

Current vs. Expected behavior

I expect to be able to pass an array of tags to the cacheTag function (as per the example given in the docs) but I see an error saying: "Argument of type 'string[]' is not assignable to parameter of type 'string'" instead

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.0.2-canary.7 // Latest available version is detected (15.0.2-canary.7).
  eslint-config-next: N/A
  react: 19.0.0-rc-1631855f-20241023
  react-dom: 19.0.0-rc-1631855f-20241023
  typescript: 5.3.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

As other places in the docs pass multiple tags as separate arguments (rather than as an array) which is the actual type signature of the cacheTag function, I wonder if it's just the case of the docs being wrong here

tomdohnal avatar Oct 26 '24 10:10 tomdohnal