generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Labels
Description
Description
Typescript definition files generated by nuqs include 'use client' directive, which cause typescript type error when running tsc. I don't see reason why this directive should be in the *.d.ts files. The problem can be fixed with "skipLibCheck": true option, but I would rather keep it as false.
Context
package.json:
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "tsc"
},
"keywords": [],
"author": "",
"license": "MIT",
"description": "",
"dependencies": {
"nuqs": "^2.8.3",
"react": "^19.2.1",
"typescript": "^5.9.3"
},
"devDependencies": {
"@types/react": "^19.2.7"
}
}tsconfig.json:
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": [],
"jsx": "react",
"strict": true,
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"noEmit": true,
"declaration": true,
"declarationMap": true,
"verbatimModuleSyntax": true,
"isolatedDeclarations": true,
"moduleDetection": "force",
"downlevelIteration": true,
"isolatedModules": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": false
},
"include": ["src/*.ts"],
"exclude": ["node_modules"]
}src/index.ts
import { useQueryState } from 'nuqs';
import { renderQueryString } from 'nuqs/adapters/custom';Reproduction
- Copy the minimal setup provided in context
- Run
npm run test - See error
Gotten error:
$ tsc
node_modules/nuqs/dist/adapters/custom.d.ts:1:1 - error TS1036: Statements are not allowed in ambient contexts.
1 'use client';
~~~~~~~~~~~~
node_modules/nuqs/dist/index.d.ts:1:1 - error TS1036: Statements are not allowed in ambient contexts.
1 'use client';
~~~~~~~~~~~~
Found 2 errors in 2 files.
Errors Files
1 node_modules/nuqs/dist/adapters/custom.d.ts:1
1 node_modules/nuqs/dist/index.d.ts:1
Reactions are currently unavailable