Skip to content

typecheck dependsOn build and this doubles the typechecking time #31892

Description

@fregante

Current Behavior

nx typecheck my-lib will trigger both build and typecheck. This happens on a fresh workspace, I just run the 2 commands suggested by the docs

According to https://nx.dev/blog/nx-update-20-5#typescript-project-references-improvements, these tasks are redundant and I think it says typecheck should not have been inferred at all.

nx typecheck my-lib

> nx run @my-org/my-lib:build  [local cache]

> tsc --build tsconfig.lib.json


> nx run @my-org/my-lib:typecheck  [local cache]

> tsc --build --emitDeclarationOnly

Expected Behavior

No build step should be executed:

nx typecheck my-lib

> nx run @my-org/my-lib:typecheck  [local cache]

> tsc --build --emitDeclarationOnly

Steps to Reproduce

npx create-nx-workspace my-org --preset=ts
cd my-org
nx g @nx/js:lib libs/my-lib # choose tsc as the builder
nx typecheck my-lib

Nx Report

NX   Report complete - copy this into the issue template

Node           : 22.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.9.2

nx             : 21.2.2
@nx/js         : 21.2.2
@nx/workspace  : 21.2.2
@nx/devkit     : 21.2.2
typescript     : 5.8.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
---------------------------------------

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions