diff --git a/src/utils/common.test.ts b/src/utils/common.test.ts index d89cd79..ba58322 100644 --- a/src/utils/common.test.ts +++ b/src/utils/common.test.ts @@ -4,6 +4,7 @@ describe('CommonUtils', () => { describe('stripArrayTypeIfPresent', () => { it('remove array brackets from the type if present', () => { expect(stripArrayTypeIfPresent('string[]')).toBe('string'); + expect(stripArrayTypeIfPresent('string[5]')).toBe('string'); }); it('return types which are not array without any change', () => { diff --git a/src/utils/common.ts b/src/utils/common.ts index c8baa98..ae1b297 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -5,8 +5,8 @@ * @returns Parameter string with array brackets [] removed. */ export const stripArrayTypeIfPresent = (typeString: string) => { - if (typeString?.match(/\S\[\]$/u) !== null) { - return typeString.replace(/\[\]$/gu, '').trim(); + if (typeString?.match(/\S\[\d*\]$/u) !== null) { + return typeString.replace(/\[\d*\]$/gu, '').trim(); } return typeString; };