Skip to content

TS dev files: unchecked, or published to npm #81473

Description

@manzoorwanijk

What problem does this address?

tsconfig.base.json excludes **/test/**: 397 TS test files across 44 packages are never checked:

$ echo "const brokenOnPurpose: number = 'not a number';" >> packages/blob/src/test/index.ts
$ npx tsc -b packages/blob --force; echo $?
0
packages/blob/src/test/index.ts(40,11): error TS2304: Cannot find name 'global'.
packages/blob/src/test/index.ts(82,31): error TS2339: Property 'toHaveStyle' does not exist on type 'JestMatchers<HTMLAnchorElement>'.

Stories are the inverse, type checked but shipped: the components tarball carries 248 story .d.ts files:

$ cd packages/components && npm pack --dry-run
npm notice 672B build-types/alignment-matrix-control/stories/index.story.d.ts
npm notice 422B build-types/alignment-matrix-control/stories/index.story.d.ts.map
...

Jest types leak into 10+ src projects; theme copes with five bespoke tsconfigs.

What is your proposed solution?

Constraints:

  • All TS files type checked: src, tests, stories, scripts.
  • No test or story output in build-types or tarballs.
  • Build does not check dev files.
  • IDE checking works everywhere, correct ambient types.
  • Jest globals never leak into src (CLI and IDE).
  • Isolated installs compatible: type deps per package - Explore using npm install-strategy=linked #75814.
  • Incremental references, low boilerplate, lint:tsconfig enforced, per-package migration.

Options:

  • A: test projects in the root solution; build checks them.
  • B (preferred): root tsconfig.json checks everything; build uses src-only tsconfig.build.json; package default configs hold dev files (jest types) and reference build configs.
  • C: one root project for all dev files; unioned ambient types.
  • D: strip dev output at publish; rejected, jest leaks.
  • Orthogonal: emit-only builds via --noCheck.

Metadata

Metadata

Assignees

Labels

[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions