As the title says, I use next-sanity for my Next.js blog. I recently wanted to update all npm packages. Now I can´t run npm run build
as the one of the dependncies itself throws a type error as follows:
./node_modules/@sanity/types/lib/dts/src/index.d.ts:756:3
Type error: Type parameter declaration expected.
754 | */
755 | export declare function defineArrayMember<
> 756 | const TType extends string | IntrinsicTypeName, // IntrinsicTypeName here improves autocompletion in _some_ IDEs (not VS Code atm)
| ^
757 | const TName extends string,
758 | TSelect extends Record<string, string> | undefined,
759 | TPrepareValue extends Record<keyof TSelect, any> | undefined,
I tried manually adding older versions of the package in question but I could not find a suitable solution so far. Deleting node_modules or package.json and then running npm i
again also did nothing to change the outcome.
Has anyone also had the same problem?
I had this problem after I ran npm update
, then I fixed the issues due to some changes mentioned in the docs. But the main issue is, that previously normally functioning features are not working despite no change inside the docs suggesting I did something wrong.
I use next 14.1.0
, next-sanity 8.5.0
and sanity 3.36.2
I faced the same issue recently!
What I have changed is updating the sanity's types to it's latest.
I used the sanity versions
cmd to check it
Here is result from the cmd
Then I updating the version based on it's version in the package.json's dependencies:
"@sanity/types": "^3.37.2",
Then I able to build already, hope it helps!