Files
zeekay c7527cda1a elements: take the escape the compiler names for baseUrl
The dts pass now fails on the option that made it work:

  error TS5101: Option 'baseUrl' is deprecated and will stop functioning in
  TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to
  silence this error.

This is the escape TypeScript itself points at, so it is what this takes.

The alternative — restating the root's ~20 `paths` entries here with rewritten
prefixes so they resolve without baseUrl — would leave two path maps to keep in
step, and one that silently disagrees with the root is a worse failure than a
deprecation notice. When TS 7 lands the answer is to drop baseUrl everywhere
and make the ROOT paths package-relative once, not to fork them per package.

Standing after this: TS2307 and TS5074 are both gone from the build. The dts
pass got from failing instantly, to 40s in, to 20s in on a different error each
time — each one the next thing behind the last.
2026-08-07 23:50:37 -07:00

56 lines
3.2 KiB
JSON

{
// baseUrl is what makes the inherited `paths` resolve to one place no matter
// who reads this file.
//
// The root config maps "lib/*" to "./frontend/src/lib/*" and declares NO
// baseUrl. TypeScript's own rule is that paths without a baseUrl resolve
// relative to the config file that DECLARES them, so `tsc` reads that as
// <repo>/frontend/src/lib/* and is happy — which is why the typecheck job is
// green while the build job is not.
//
// tsup's dts pass does not agree. It resolves the same relative entry against
// THIS directory, looks for frontend/@hanzo/elements/frontend/src/lib/*, finds
// nothing, and every `export * from 'lib/elements/...'` in src/index.ts fails
// as TS2307 — "Cannot find module 'lib/elements/Popover'". A resolver
// disagreement, not a missing file: all of those modules exist.
//
// Pointing baseUrl at the repo root removes the disagreement rather than
// arguing it. With a baseUrl present, paths are resolved against it by
// definition, so both readers land on <repo>/frontend/src/lib/*.
//
// Set here and not in the root config on purpose: adding baseUrl at the root
// would give every bare specifier in the tree a new resolution root, and the
// typecheck that passes today is the evidence the root is fine as it is. The
// blast radius of this line is one package's build.
"extends": "../../../tsconfig.json",
"compilerOptions": {
"baseUrl": "../../..",
// baseUrl is deprecated and this TypeScript refuses it outright —
// "error TS5101: Option 'baseUrl' is deprecated and will stop functioning
// in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"'
// to silence this error." This is the escape the compiler itself names.
//
// The alternative is to restate the root's ~20 `paths` entries here with
// their prefixes rewritten, which would resolve without baseUrl but leave
// two lists to keep in step — and a path map that silently disagrees with
// the root is a worse failure than a deprecation notice. When TS 7 lands,
// the fix is to drop baseUrl everywhere and make the ROOT paths
// package-relative once, not to fork them per package.
"ignoreDeprecations": "6.0",
"emitDeclarationOnly": true,
// The root turns `incremental` on, which suits a project that type-checks
// itself in place. tsup's dts pass is not that: it emits declarations to a
// directory with no build-info file, and TypeScript refuses the pair —
// "error TS5074: Option '--incremental' can only be specified using
// tsconfig, emitting to single file or when option '--tsBuildInfoFile' is
// specified". This surfaced only once baseUrl made tsup honour the config
// at all; before that it never got far enough to read `incremental`.
//
// Off rather than pointing at a tsBuildInfoFile: the cache would buy
// nothing here. Each build runs once in a fresh container, so there is no
// prior run for it to reuse, and a stale one would be a liability.
"incremental": false,
"noEmit": false
}
}