0
我正在創建一些測試數據,並且不想通過手動編寫我的類型化測試對象的麻煩 - 我寧願提供JSON並將其投射到我的案例中的DefinitelyTyped對象數組。我怎樣才能做到這一點?如何將JSON轉換爲DefinitelyTyped類型?
我試着做以下,但它仍然是回來爲Object
:
const outputData = <fhir.BundleEntry[]>JSON.parse(`{"entry": [
{
"fullUrl": "https://vonk.furore.com/Patient/1",
"resource": {
"resourceType": "Patient",
"id": "1",
"meta": {
"versionId": "b345396d-f3b6-46ce-8ceb-0b5c0dafab2e",
"lastUpdated": "2017-06-20T07:28:54.979+00:00"
},
"identifier": [
{
"type": {
"coding": [
{
"system": "http://hl7.org/fhir/v2/0203",
"code": "SS"
}
]
},
"system": "https://github.com/projectcypress/cypress/patient",
"value": "577492"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Copeland",
"given": [
"Brian"
]
}
],
"gender": "male",
"birthDate": "1949-03-15",
"managingOrganization": {
"reference": "Organization/1"
}
},
"search": {
"mode": "match"
}
}
]}`);