-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi. I'm using @nanostores/query in a TypeScript project with the "module": "nodenext" in tsconfig.json configuration.
However, I encountered an issue where some imports inside @nanostores/query are not working correctly with "module": "nodenext". Specifically, imports in "type files" (.d.ts) like import('./factory') are missing explicit extensions (.d.ts). This translates into the fact that all types from createFetcherStore become any.
Alternatively, if I switch to "module": "esnext" with "moduleResolution": "bundler", the imports work without needing explicit extensions, but then i lose "nodenext" mode.
Steps to Reproduce
- Set up a TypeScript project with the following
tsconfig.json:
{
"compilerOptions": {
/* Language and Environment */
"target": "ESNext",
/* Modules */
"module": "nodenext",
"resolveJsonModule": true,
/* Emit */
"noEmit": true,
/* Interop Constraints */
"isolatedModules": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"verbatimModuleSyntax": true,
/* Completeness */
"skipLibCheck": true
}
}-
Install
nanostores&@nanostores/queryand try to use it in the project. -
Try to create nanoquery store
or check this stackblitz example
Expected Behavior
The imports should work correctly with "module": "nodenext".
Suggested Fix
To ensure compatibility with "module": "nodenext", it would be helpful to add explicit extensions to the imports in @nanostores/query, such as:
import('./factory.d.ts');Environment
- TypeScript version: [5.5.2 & 5.6.2]
- Node.js version: [18.20.3 & 22.7.0]
@nanostores/queryversion: [0.3.4]