Skip to content

Conversation

@GinoCanessa
Copy link
Contributor

Added a string-union of known resources named FhirResourceType. Per discussion on Zulip.

@jdjkelly
Copy link
Contributor

:shipit:

@ir4y
Copy link

ir4y commented Aug 31, 2021

@GinoCanessa
I think there is a simpler way to define FhirResourceType rather than codegen.

interface Patient {
  readonly resourceType: 'Patient'
}

interface Practitioner {
  readonly resourceType: 'Practitioner'
} 

type FhirResource = Patient | Practitioner

type FhirResourceType = FhirResource['resourceType']

https://www.typescriptlang.org/play?ssl=12&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgApzMC5kG8CwAUMslBHACYD2IANgJ6kQDOVArlEgCr0AOEALmQBydJmxhhRAL5EioSLEQpUURJkw1oeIiTKUaDJqw7c+gkavXBNIaFMLTkcwmHPIAYgAtgUAEos7JwoALxoGFg4AD5oaggawFpQLm78nj7+gaYQPGlh3r4BJsEA2sJkxWb8wgC6LkRAA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants