From 1600edba0600273b4913b6efca7474f82f9b7e59 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Wed, 6 Mar 2024 14:01:21 +0100 Subject: [PATCH] make linter happy --- compiler/src/model/build-model.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/src/model/build-model.ts b/compiler/src/model/build-model.ts index fb2cf960d6..7c87f19fd0 100644 --- a/compiler/src/model/build-model.ts +++ b/compiler/src/model/build-model.ts @@ -270,14 +270,14 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int const queryType = type.query.find(property => property != null && property.name === part.name) as model.Property if (!deepEqual(queryType.type, part.type)) { assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the query_parameters with a different type, you should define an @codegen_name.`) - assert(pathMember as Node, !type.query.map(p => p.codegenName || p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`) + assert(pathMember as Node, !type.query.map(p => p.codegenName ?? p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in query_parameters.`) } } if (bodyProperties.map(p => p.name).includes(part.name)) { const bodyType = bodyProperties.find(property => property != null && property.name === part.name) as model.Property if (!deepEqual(bodyType.type, part.type)) { assert(pathMember as Node, part.codegenName != null, `'${part.name}' already exist in the body with a different type, you should define an @codegen_name.`) - assert(pathMember as Node, !bodyProperties.map(p => p.codegenName || p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`) + assert(pathMember as Node, !bodyProperties.map(p => p.codegenName ?? p.name).includes(part.codegenName), `The codegen_name '${part.codegenName}' already exists as parameter in body.`) } } } @@ -296,7 +296,7 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int ) assert( (bodyMember as PropertySignature).getJsDocs(), - !type.path.map(p => p.codegenName || p.name).concat(type.query.map(p => p.codegenName || p.name)).includes(tags.codegen_name), + !type.path.map(p => p.codegenName ?? p.name).concat(type.query.map(p => p.codegenName ?? p.name)).includes(tags.codegen_name), `The codegen_name '${tags.codegen_name}' already exists as a property in the path or query.` ) type.body = {