Version
@adcp/sdk@14.0.0-beta.29
- bundled AdCP schemas:
3.2.0-beta.11
- TypeScript
5.9.2, strict: true, skipLibCheck: false
- Node
24.14.1
Minimal reproduction
import type { GetReportingStatusResponse } from '@adcp/sdk/types/get-reporting-status'
const response: GetReportingStatusResponse = {
status: 'failed',
view: 'revision',
failure_kind: 'operational',
errors: [{ code: 'INTERNAL_ERROR', message: 'Temporarily unavailable.' }],
}
void response
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"skipLibCheck": false,
"noEmit": true
}
}
Running tsc reports:
error-type.ts(7,14): error TS2322: Type 'string' is not assignable to type '"NOT_FOUND"'.
error-type.ts(7,38): error TS2322: Type 'string' is not assignable to type '"Reporting status resource is unavailable."'.
The same operational-failure JSON is valid under the bundled media-buy/get-reporting-status-response.json schema.
Cause
The advertised self-contained per-tool declaration uses Error in the base response and in OperationalFailure (errors: Error[]) but does not declare or import the protocol Error type. TypeScript therefore resolves the JavaScript global Error. Intersecting the base response with FailedLookup makes the operational arm effectively uninhabitable and produces the misleading unavailable-lookup literal errors above.
UnavailableLookup does not exhibit the same problem because it inlines its exact error object.
Expected
The per-tool generator should emit the protocol error declaration (or inline the operational error shape), so a schema-valid OperationalFailure is assignable to GetReportingStatusResponse without a cast.
Version
@adcp/sdk@14.0.0-beta.293.2.0-beta.115.9.2,strict: true,skipLibCheck: false24.14.1Minimal reproduction
{ "compilerOptions": { "target": "ES2022", "module": "NodeNext", "moduleResolution": "NodeNext", "strict": true, "skipLibCheck": false, "noEmit": true } }Running
tscreports:The same operational-failure JSON is valid under the bundled
media-buy/get-reporting-status-response.jsonschema.Cause
The advertised self-contained per-tool declaration uses
Errorin the base response and inOperationalFailure(errors: Error[]) but does not declare or import the protocol Error type. TypeScript therefore resolves the JavaScript globalError. Intersecting the base response withFailedLookupmakes the operational arm effectively uninhabitable and produces the misleading unavailable-lookup literal errors above.UnavailableLookupdoes not exhibit the same problem because it inlines its exact error object.Expected
The per-tool generator should emit the protocol error declaration (or inline the operational error shape), so a schema-valid
OperationalFailureis assignable toGetReportingStatusResponsewithout a cast.