diff --git a/packages/utils/src/__tests__/stripTagsUtil.spec.ts b/packages/utils/src/__tests__/stripTagsUtil.spec.ts index 2d0b42775..4f419183d 100644 --- a/packages/utils/src/__tests__/stripTagsUtil.spec.ts +++ b/packages/utils/src/__tests__/stripTagsUtil.spec.ts @@ -121,13 +121,5 @@ describe('stripTags()', () => { it('should throw when input is not a string neither a number', () => { expect(() => stripTags(['type-confusion'] as any)).toThrow(`'html' parameter must be a string`); }); - - it('should throw when input is undefined', () => { - expect(() => stripTags(undefined as any)).toThrow(`'html' parameter must be a string`); - }); - - it('should throw when input is null', () => { - expect(() => stripTags(null as any)).toThrow(`'html' parameter must be a string`); - }); }); }); \ No newline at end of file diff --git a/packages/utils/src/stripTagsUtil.ts b/packages/utils/src/stripTagsUtil.ts index c52d2a823..7a9a72a62 100644 --- a/packages/utils/src/stripTagsUtil.ts +++ b/packages/utils/src/stripTagsUtil.ts @@ -39,7 +39,7 @@ export function stripTags(htmlText: string | number | boolean | HTMLElement, all if (html instanceof HTMLElement) { html = html.innerHTML; } - if (typeof html !== 'string' && html !== undefined) { + if (typeof html !== 'string' && html !== undefined && html !== null) { throw new TypeError(`'html' parameter must be a string`); }