Skip to content

script-utils/validate-declarations

Type-checks the generated declaration files (.d.cts / .d.mts) to prove they are self-contained — every lib and internal cross-reference they rely on resolves on its own, independent of the consumer’s tsconfig.

Only diagnostics whose source file is one we own (under the project root, outside node_modules) are reported. Diagnostics inside node_modules — broken upstream .d.ts files we do not control — are ignored. Cross-module-format interop diagnostics in our own declarations (for example a CommonJS .d.cts importing an ESM-only package, TS1541 / TS1542 / TS1479) are NOT ignored: they describe declarations we emit, so the generator must produce valid output (e.g. add the required resolution-mode attribute) rather than the validator hiding the problem.

InterfaceDescription
ValidateDeclarationsOptionsOptions for validateDeclarations.
FunctionDescription
validateDeclarationsValidates the generated declaration files against the tsconfig.validate-declarations*.json configs, reporting every diagnostic that concerns the library’s own declarations and ignoring only those whose source file lives in node_modules.