Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make generic type for services required #18

Open
ruscoder opened this issue May 27, 2020 · 1 comment
Open

Make generic type for services required #18

ruscoder opened this issue May 27, 2020 · 1 comment

Comments

@ruscoder
Copy link
Member

Example,
export async function getFHIRResources<R extends AidboxResource = never>
will force you to specify type

@ruscoder ruscoder self-assigned this Oct 18, 2020
@ruscoder
Copy link
Member Author

There is another better approach to define typings in a better way, for example, define a list of all resources in our typings (e.g., type ResourceTypeMap = { Patient: Patient, Practitioner: Practitioner, ...}) and then use T extends keyof ResourceTypeMap instead of T extends AidboxResource

@ruscoder ruscoder removed their assignment Apr 21, 2023
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

No branches or pull requests

1 participant