Skip to content

Commit e996cf9

Browse files
rollback: readability
1 parent afc6454 commit e996cf9

File tree

1 file changed

+4
-6
lines changed
  • npm/ng-packs/packages/schematics/src/utils

1 file changed

+4
-6
lines changed

npm/ng-packs/packages/schematics/src/utils/model.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,10 @@ export function createRefToImportReducerCreator(params: ModelGeneratorParams) {
187187
}
188188

189189
function isOptionalProperty(prop: PropertyDef) {
190-
const { isRequired, typeSimple } = prop;
191-
if (typeSimple === 'string' || typeSimple.includes('enum')) {
192-
return !isRequired;
193-
} else {
194-
return typeSimple.endsWith('?');
195-
}
190+
return (
191+
prop.typeSimple.endsWith('?') ||
192+
((prop.typeSimple === 'string' || prop.typeSimple.includes('enum')) && !prop.isRequired)
193+
);
196194
}
197195

198196
export function parseBaseTypeWithGenericTypes(type: string): string[] {

0 commit comments

Comments
 (0)