Skip to content

Commit

Permalink
Changes as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-sedinkin committed Aug 6, 2024
1 parent a4327cf commit b17f35a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"engines": {
"node": ">=8.9.0"
},
"tsd": {
"directory": "test/typescript"
},
"scripts": {
"postinstall": "echo \"Building the Benny package based on a pull request which fixes an issue with 'statusShift'... \" && (cd node_modules/benny && npm i && npm run build > /dev/null) || echo \"Building the Benny package is completed.\"",
"generateParser": "cd src/parser; rimraf ./generated/*; java -Xmx500M -cp \"../../antlr-4.9.3-complete.jar:$CLASSPATH\" org.antlr.v4.Tool -o generated -Dlanguage=JavaScript FHIRPath.g4; grunt updateParserRequirements",
Expand Down
12 changes: 10 additions & 2 deletions src/fhirpath.test-d.ts → test/typescript/fhirpath.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file contains unit tests for TypeScript type declarations.
import * as fhirpath from './fhirpath';
import * as model from '../fhir-context/r4'
import * as fhirpath from '../../src/fhirpath';
import * as model from '../../fhir-context/r4'
import {expectType} from "tsd";

const fhirData = {};
Expand All @@ -24,6 +24,14 @@ expectType<any[]>(
fhirpath.compile(somePath, model, {async: false})(fhirData, envVars)
);

// If the async parameter is not passed in, the return type should be "any[]".
expectType<any[]>(
fhirpath.evaluate(fhirData, somePath, envVars, model, {})
);
expectType<any[]>(
fhirpath.compile(somePath, model, {})(fhirData, envVars)
);

// If the async parameter is true, the return type should be
// "Promise<any[]> | any[]".
expectType<Promise<any[]> | any[]>(
Expand Down

0 comments on commit b17f35a

Please sign in to comment.