Impact
Projects can receive generated TypeScript that passes the plugin's syntax validation but fails strict TypeScript compilation. This breaks the promise that successful generation returns importable contracts and blocks Feature #13 acceptance.
Observed behavior
The additional-properties compatibility check treats two object projections as equal when they contain the same property names, even if the property types differ. A fixed property of type { value: string } is therefore considered assignable to an index value of type { value: number }, and the plugin retains the incompatible typed index signature.
Expected behavior
A schema-valued additionalProperties type is retained only when every fixed property is assignable to it. Otherwise the index value widens to unknown, as required by the TypeScript interaction output specification.
Reproduction
- Define an object schema with required property
fixed whose inline type is { value: string }.
- Set
additionalProperties to an inline object type { value: number }.
- Run
typescript() and compile the returned artifact with strict TypeScript settings.
- Observe that
fixed is not assignable to the generated string index type.
Verification
Evidence
Generated shape:
export type InvalidTypedMap = {
fixed: { value: string };
[key: string]: { value: number };
};
Compiler diagnostic:
Property 'fixed' of type '{ value: string; }' is not assignable to 'string' index type '{ value: number; }'.
Linked artifacts
Impact
Projects can receive generated TypeScript that passes the plugin's syntax validation but fails strict TypeScript compilation. This breaks the promise that successful generation returns importable contracts and blocks Feature #13 acceptance.
Observed behavior
The additional-properties compatibility check treats two object projections as equal when they contain the same property names, even if the property types differ. A fixed property of type
{ value: string }is therefore considered assignable to an index value of type{ value: number }, and the plugin retains the incompatible typed index signature.Expected behavior
A schema-valued
additionalPropertiestype is retained only when every fixed property is assignable to it. Otherwise the index value widens tounknown, as required by the TypeScript interaction output specification.Reproduction
fixedwhose inline type is{ value: string }.additionalPropertiesto an inline object type{ value: number }.typescript()and compile the returned artifact with strict TypeScript settings.fixedis not assignable to the generated string index type.Verification
unknown.Evidence
Generated shape:
Compiler diagnostic:
Linked artifacts
openspec/changes/add-typescript-output-plugin/specs/typescript-interaction-output/spec.md