From 9954040609aad23489b086ed833f85da7ae2b052 Mon Sep 17 00:00:00 2001 From: danielpeintner Date: Wed, 20 Sep 2023 11:31:49 +0200 Subject: [PATCH] fix: add proper boolean check --- packages/td-tools/src/thing-model-helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/td-tools/src/thing-model-helpers.ts b/packages/td-tools/src/thing-model-helpers.ts index 970da554b..7e99cf6a6 100644 --- a/packages/td-tools/src/thing-model-helpers.ts +++ b/packages/td-tools/src/thing-model-helpers.ts @@ -405,7 +405,7 @@ export class ThingModelHelpers { for (const key in submodelObj) { const sub = submodelObj[key]; - if (options.selfComposition != null) { + if (options.selfComposition === true) { if (!data.links) { throw new Error( "You used self composition but links are missing; they are needed to extract the instance name" @@ -449,7 +449,7 @@ export class ThingModelHelpers { } } } - if (!data.links || options.selfComposition != null) { + if (!data.links || options.selfComposition === true) { data.links = []; } // add reference to the thing model @@ -508,7 +508,7 @@ export class ThingModelHelpers { extendedModel.properties = {}; } for (const key in properties) { - if (dest.properties != null && dest.properties[key] != null) { + if (dest.properties && dest.properties[key] != null) { extendedModel.properties[key] = { ...properties[key], ...dest.properties[key] }; } else { extendedModel.properties[key] = properties[key];