Skip to content

Commit

Permalink
fix(reflection): fix array property type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Aug 31, 2022
1 parent 75a6487 commit 4a69871
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/reflection/src/TsMorphMetadataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export class TsMorphMetadataProvider extends MetadataProvider {
.replace(/\[]$/, '') // remove array suffix
.replace(/\((.*)\)/, '$1'); // unwrap union types

if (prop.array && !type.endsWith('[]') && !type.includes(' | ')) {
type += '[]';
}

return { type, optional };
}

Expand Down

0 comments on commit 4a69871

Please sign in to comment.