Currently, slice flat types strip discriminator keys entirely:
export type Observation_bodyweight_Category_VSCatSliceFlat = Omit<CodeableConcept, "coding">;
This makes the type look useless — it's a CodeableConcept minus coding, leaving only text, id, and extension.
Proposal
Include the discriminator values as literal types instead of omitting them:
export type Observation_bodyweight_Category_VSCatSliceFlat = Omit<CodeableConcept, "coding"> & {
coding: [{ code: "vital-signs"; system: "http://terminology.hl7.org/CodeSystem/observation-category" }];
};
This way the flat type carries the fixed discriminator value at the type level, which is useful for type-level checks and documentation. The flat getter would continue to strip discriminator keys at runtime.
Scope
- Affects
src/api/writer-generator/typescript/profile.ts and profile-slices.ts
- Applies to all slice flat types across all profiles (VSCat, SystolicBP, DiastolicBP, etc.)
Currently, slice flat types strip discriminator keys entirely:
This makes the type look useless — it's a
CodeableConceptminuscoding, leaving onlytext,id, andextension.Proposal
Include the discriminator values as literal types instead of omitting them:
This way the flat type carries the fixed discriminator value at the type level, which is useful for type-level checks and documentation. The flat getter would continue to strip discriminator keys at runtime.
Scope
src/api/writer-generator/typescript/profile.tsandprofile-slices.ts