TypeSchema/TS: drop isWithMetaField; inline isResourceIdentifier(base) - #159
TypeSchema/TS: drop isWithMetaField; inline isResourceIdentifier(base)#159ryukzak wants to merge 1 commit into
Conversation
In FHIR only resources carry `meta`, so the hierarchy walk in isWithMetaField is equivalent to `isResourceIdentifier(profile.base)`. Inlining the check removes a redundant index helper and simplifies a couple of writer conditions. - Remove isWithMetaField from TypeSchemaIndex (interface, implementation, return-object key). - Inline isResourceIdentifier(flatProfile.base) at both call sites. - Simplify canEmitIs from `(hasMeta && isResourceIdentifier(base)) || base.name === "Extension"` to `hasMeta || base.name === "Extension"`, and the nested branch from `hasMeta && isResourceIdentifier(base)` to just `hasMeta`. - Drop now-unused tsIndex params from generateProfileHelpersImport and generateFactoryMethods. - Remove stale entry from docs/guides/typeschema-index.md.
fc8eb12 to
3b1fceb
Compare
|
Closing — the simplification is unsound. CI surfaced the issue: After inlining, the writer emits The hierarchy walk in The right home for this concept is on the future snapshot facts (precomputed |
In FHIR only resources carry
meta, so the hierarchy walk inisWithMetaFieldis equivalent toisResourceIdentifier(flatProfile.base). Inlining the check removes a redundant index helper and simplifies a couple of writer conditions.Changes
isWithMetaFieldfromTypeSchemaIndex(interface, implementation, return-object key).isResourceIdentifier(flatProfile.base)at both call sites insrc/api/writer-generator/typescript/profile.ts.canEmitIsfrom(hasMeta && isResourceIdentifier(base)) || base.name === "Extension"tohasMeta || base.name === "Extension", and the nested branch fromhasMeta && isResourceIdentifier(base)to justhasMeta.tsIndexparams fromgenerateProfileHelpersImportandgenerateFactoryMethods.docs/guides/typeschema-index.md.Verification
bun run typecheckcleanbunx biome checkclean (only pre-existing warnings)bun test257/257 pass