Problem
packages/typespec-ts/test/commands/run.ts builds an api-extractor config in memory (no api-extractor.json on disk) and relies on the private ExtractorConfig._defaultConfig static to get the built-in defaults:
structuredClone((ExtractorConfig as any)._defaultConfig)
In @microsoft/api-extractor 7.59.0, this internal was moved from a static class property to a module-level constant, so ._defaultConfig returns undefined and the config merge crashes with:
TypeError: Cannot read properties of undefined (reading 'apiReport')
This breaks every declaration-rollup emit in the Spector e2e job.
Current workaround
PR #5212 pins @microsoft/api-extractor to ~7.58.1 via an override in pnpm-workspace.yaml to avoid resolving 7.59.0.
Proposed fix
Replace the _defaultConfig access with one of:
- Loading
schemas/api-extractor-defaults.json directly via JsonFile.load from @rushstack/node-core-library (the file is JSONC, so plain JSON.parse won't work)
- Using a supported public API if one exists for getting default config values
- Restructuring the test to use
ExtractorConfig.loadFile with a temporary config file
Once fixed, the @microsoft/api-extractor override can be removed from pnpm-workspace.yaml.
Problem
packages/typespec-ts/test/commands/run.tsbuilds an api-extractor config in memory (noapi-extractor.jsonon disk) and relies on the privateExtractorConfig._defaultConfigstatic to get the built-in defaults:In
@microsoft/api-extractor7.59.0, this internal was moved from a static class property to a module-level constant, so._defaultConfigreturnsundefinedand the config merge crashes with:This breaks every declaration-rollup emit in the Spector e2e job.
Current workaround
PR #5212 pins
@microsoft/api-extractorto~7.58.1via an override inpnpm-workspace.yamlto avoid resolving 7.59.0.Proposed fix
Replace the
_defaultConfigaccess with one of:schemas/api-extractor-defaults.jsondirectly viaJsonFile.loadfrom@rushstack/node-core-library(the file is JSONC, so plainJSON.parsewon't work)ExtractorConfig.loadFilewith a temporary config fileOnce fixed, the
@microsoft/api-extractoroverride can be removed frompnpm-workspace.yaml.