Skip to content

Typescript error after installing nuqs - Declaration or statement expected. #1107

@Aniket-IN

Description

@Aniket-IN

Context

What's your version of nuqs?

"nuqs": "^2.5.2"

What framework are you using?

  • ✅ Next.js (pages router)

Which version of your framework are you using?

next: 14.2.32
eslint-config-next: 14.2.32
react: 18.3.1
react-dom: 18.3.1
typescript: 4.9.4

Description

When I try to do npm run build, I get this error:

./node_modules/nuqs/dist/index.d.ts:178:39
Type error: Type parameter declaration expected.

  176 | * @param validValues The values you want to accept
  177 | */
> 178 | declare function parseAsStringLiteral<const Literal extends string>(validValues: readonly Literal[]): ParserBuilder<Literal>;        
      |                                       ^
  179 | /**
  180 | * Number-based literals provide better type-safety for known sets of values.
  181 | * You will need to pass the parseAsNumberLiteral function a list of your number values

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions