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

FHIR type Meta requiring lastUpdated property when spec allows it to be optional #170

Open
adunsulag opened this issue May 20, 2023 · 0 comments

Comments

@adunsulag
Copy link

I ran into a typescript incompatibility problem on the Meta object types when using this library and the R4 FHIR definitions from @types/fhir. I thought it must be a problem in @types/fhir but when I compare both libraries to the HL7 specification it looks like the client-js types.d.ts file is incorrect in the type definition for the Meta object.
Specifically this is the error I get

Argument of type 'QuestionnaireResponse' is not assignable to parameter of type 'Resource'.
  Types of property 'meta' are incompatible.
    Type 'fhir4.Meta' is not assignable to type 'import("/home/*****/projects/*****/node_modules/fhirclient/lib/types").fhirclient.FHIR.Meta'.
      Property 'lastUpdated' is optional in type 'Meta' but required in type 'Meta'.ts(2345)

The spec here for R4 (as well as the latest 5.0) show lastUpdated as an optional value when creating a resource:
http://hl7.org/fhir/R4/resource.html

However in the client-js library it forces the lastUpdated to be mandatory which creates the error I'm running into.

lastUpdated: instant;

I believe this needs to be changed to be optional, but if I'm misreading the specification that's fine. The change would just need to be:

lastUpdated ?: instant;

Happy to do a pull request if the project would accept it.

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