File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
npm/ng-packs/packages/schematics/src/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,12 @@ export function createImportRefToInterfaceReducerCreator(params: ModelGeneratorP
148148 typeDef . properties ?. forEach ( prop => {
149149 let name = prop . jsonName || camel ( prop . name ) ;
150150 name = shouldQuote ( name ) ? `'${ name } '` : name ;
151- const type = simplifyType ( prop . type ) ;
151+
152+ let type = simplifyType ( prop . typeSimple ) ;
153+ if ( prop . typeSimple . includes ( 'enum' ) ) {
154+ type = simplifyType ( prop . type ) ;
155+ }
156+
152157 const refs = parseType ( prop . type ) . reduce (
153158 ( acc : string [ ] , r ) => acc . concat ( parseGenerics ( r ) . toGenerics ( ) ) ,
154159 [ ] ,
@@ -182,7 +187,10 @@ export function createRefToImportReducerCreator(params: ModelGeneratorParams) {
182187}
183188
184189function isOptionalProperty ( prop : PropertyDef ) {
185- return prop . typeSimple . endsWith ( '?' ) || ( prop . typeSimple === 'string' && ! prop . isRequired ) ;
190+ return (
191+ prop . typeSimple . endsWith ( '?' ) ||
192+ ( ( prop . typeSimple === 'string' || prop . typeSimple . includes ( 'enum' ) ) && ! prop . isRequired )
193+ ) ;
186194}
187195
188196export function parseBaseTypeWithGenericTypes ( type : string ) : string [ ] {
You can’t perform that action at this time.
0 commit comments