Skip to content

Commit

Permalink
fix: Handle Identifier case for isReference
Browse files Browse the repository at this point in the history
  • Loading branch information
jdjkelly committed Feb 27, 2024
1 parent 7e26d6d commit fc73321
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/core/src/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ describe('Type Utils', () => {
expect(isReference({})).toBe(false);
expect(isReference({ resourceType: 'Patient' })).toBe(false);
expect(isReference({ reference: 'Patient/123' })).toBe(true);
expect(isReference({ reference: { value: '123' }})).toBe(false);
});

test.each<[TypedValue, string]>([
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export function isResource(value: unknown): value is Resource {
* @returns True if the input is of type 'object' and contains property 'reference'
*/
export function isReference(value: unknown): value is Reference & { reference: string } {
return !!(value && typeof value === 'object' && 'reference' in value);
return !!(value && typeof value === 'object' && 'reference' in value && typeof value.reference === 'string');
}

/**
Expand Down

0 comments on commit fc73321

Please sign in to comment.