Skip to content

Export TypeScript Schema Definitions in package.json for Better DX #33336

@arunaaruns

Description

@arunaaruns

🌨 Feature Request: Export TypeScript Schema Definitions in package.json for Better DX

🧩 Description

Nx 21.0.0 introduced stricter package exports that block direct imports of TypeScript schema definitions.

These schema types are essential for creating custom executors, generators, and workspace tooling.

Exporting them officially in package.json would greatly improve the developer experience (DX) and maintain type safety.

Problem

With Nx 21.0.0, the stricter package exports prevent importing TypeScript schema definitions that are needed for creating custom executors and generators. This forces developers to either:

  1. Copy entire schema files into their workspace (high maintenance burden)

  2. Define local interfaces (current workaround)

  3. Use any types (loses type safety)

Current Behavior

// This fails in Nx 21.0.0+

import { Schema } from '@nx/angular/src/builders/webpack-browser/schema';

import { Schema } from '@nx/react/src/generators/application/schema';

Files Affected:

  • @nx/angular/src/builders/*/schema.d.ts

  • @nx/react/src/generators/*/schema.d.ts

  • @nx/workspace/src/generators/*/schema.d.ts

  • And other packages with schema definitions

Environment:

Nx version: 21.0.0

Affected packages: @nx/angular, @nx/react, @nx/workspace, etc.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions