Current Behavior
The current typecheck target generated by @nx/js/typescript is not compatible with the
TypeScript project references / workspace setup.
The documentation states that both tsconfig.spec.json and tsconfig.lib.json should be
referenced from the project-level tsconfig.json. However, the generated typecheck target
is hardcoded to use tsconfig.json, with no option to configure a different tsconfig file.
As a result, it is currently not possible to use the generated typecheck target to
typecheck only production files with the setup describe in the doc.
Expected Behavior
We should be able to specify which tsconfig to run for the typecheck target
Example:
"plugins": [
{
"plugin": "@nx/js/typescript",
"options": {
"typecheck": {
"targetName": "typecheck",
"configName": "tsconfig.lib.json",
}
}
}
GitHub Repo
No response
Steps to Reproduce
- Create a new workspace using Nx with the
@nx/js plugin.
- Generate a library using
@nx/js.
- Configure TypeScript project references by following the official documentation:
https://nx.dev/docs/technologies/typescript/guides/switch-to-workspaces-project-references#update-individual-project-typescript-configuration
- Create
tsconfig.lib.json
- Create
tsconfig.spec.json
- Configure
tsconfig.json to reference both configs
- Run the inferred
typecheck target for the library.
- Observe that test files are included in the typecheck, even though only production files are expected.
Nx Report
Node : 25.2.0
OS : linux-x64
Native Target : x86_64-linux
pnpm : 10.22.0
daemon : Available
nx : 22.4.2
@nx/js : 22.4.1
@nx/eslint : 22.3.3
@nx/workspace : 22.4.1
@nx/jest : 22.4.2
@nx/devkit : 22.3.3
@nx/esbuild : 22.3.3
@nx/eslint-plugin : 22.3.3
@nx/module-federation : 22.4.2
@nx/nest : 22.3.3
@nx/next : 22.4.2
@nx/node : 22.4.2
@nx/playwright : 22.3.3
@nx/react : 22.4.2
@nx/rollup : 22.4.2
@nx/vite : 22.4.2
@nx/vitest : 22.3.3
@nx/web : 22.3.3
@nx/webpack : 22.3.3
@nx/docker : 22.4.2
typescript : 5.9.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/next/plugin
@nx/eslint/plugin
@nx/vitest
@nx/playwright/plugin
@nx/webpack/plugin
---------------------------------------
Cache Usage: 0.00 B / 1.83 GB
---------------------------------------
The following packages should match the installed version of nx
- @nx/js@22.4.1
- @nx/eslint@22.3.3
- @nx/workspace@22.4.1
- @nx/devkit@22.3.3
- @nx/esbuild@22.3.3
- @nx/eslint-plugin@22.3.3
- @nx/nest@22.3.3
- @nx/playwright@22.3.3
- @nx/vitest@22.3.3
- @nx/web@22.3.3
- @nx/webpack@22.3.3
To fix this, run `nx migrate nx@22.4.2`
---------------------------------------
⚠️ Multiple Nx versions detected
Your workspace uses nx@22.4.2, but other packages depend on a different version:
- @nx/esbuild → @nx/devkit → nx@22.3.3
- @nx/js → @nx/devkit → nx@22.4.1
These packages should not have nx as a dependency. Please report this issue to the package maintainers.
Run `pnpm why nx@22.3.3` for more details.
Run `pnpm why nx@22.4.1` for more details.
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response
Current Behavior
The current
typechecktarget generated by@nx/js/typescriptis not compatible with theTypeScript project references / workspace setup.
The documentation states that both
tsconfig.spec.jsonandtsconfig.lib.jsonshould bereferenced from the project-level
tsconfig.json. However, the generatedtypechecktargetis hardcoded to use
tsconfig.json, with no option to configure a different tsconfig file.As a result, it is currently not possible to use the generated
typechecktarget totypecheck only production files with the setup describe in the doc.
Expected Behavior
We should be able to specify which tsconfig to run for the
typechecktargetExample:
GitHub Repo
No response
Steps to Reproduce
@nx/jsplugin.@nx/js.https://nx.dev/docs/technologies/typescript/guides/switch-to-workspaces-project-references#update-individual-project-typescript-configuration
tsconfig.lib.jsontsconfig.spec.jsontsconfig.jsonto reference both configstypechecktarget for the library.Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response