Ahryman40k / typescript-fhir-types

Typescript / Javascript object model for FHIR standard
MIT License
126 stars 27 forks source link

Solve union issue with io-ts #2

Closed Ahryman40k closed 5 years ago

Ahryman40k commented 5 years ago

PASS src/tests/account_coverage.spec.ts PASS src/tests/tryout.spec.ts PASS src/tests/account_guarantor.spec.ts (17.176s) FAIL src/tests/account.spec.ts ● Test suite failed to run

TypeError: Cannot read property 'name' of undefined

  146 | import * as t from 'io-ts';
  147 | 
> 148 | export const RTTI_ResourceList = t.union([
      |                                    ^
  149 |     RTTI_Account,
  150 |     RTTI_ActivityDefinition,
  151 |     RTTI_AdverseEvent,

  at node_modules/io-ts/lib/index.js:764:59
      at Array.map (<anonymous>)
  at getUnionName (node_modules/io-ts/lib/index.js:764:25)
  at Object.<anonymous>.exports.union (node_modules/io-ts/lib/index.js:770:35)
  at Object.<anonymous> (src/Union/RTTI_ResourceList.ts:148:36)
  at Object.<anonymous> (src/Resource/RTTI_Account.ts:6:1)
  at Object.<anonymous> (src/__tests__/account.spec.ts:1:1)

Test Suites: 1 failed, 3 passed, 4 total Tests: 5 passed, 5 total Snapshots: 0 total Time: 22.055s

Ahryman40k commented 5 years ago

When solved, I may make resources 'exact'

Ahryman40k commented 5 years ago

Solved,

hahaha, I didn't make a recursion of union as all types do !

Ahryman40k commented 5 years ago

Fixed in 4.0.4