diff --git a/components/message/__tests__/config.test.ts b/components/message/__tests__/config.test.ts index ef7912e447..d79bdda7ea 100644 --- a/components/message/__tests__/config.test.ts +++ b/components/message/__tests__/config.test.ts @@ -168,7 +168,7 @@ describe('message.config', () => { }); it('should be able to config getContainer, although messageInstance already exists', () => { - function createContainer() { + function createContainer(): [HTMLElement, () => void] { const container = document.createElement('div'); document.body.appendChild(container); return [ diff --git a/tests/setupAfterEnv.ts b/tests/setupAfterEnv.ts index ed6d75e0bc..7802d4be12 100644 --- a/tests/setupAfterEnv.ts +++ b/tests/setupAfterEnv.ts @@ -55,7 +55,7 @@ expect.addSnapshotSerializer({ // Clean up `data-reactroot` since React 18 do not have this children.forEach((ele: HTMLElement) => { - if (ele && typeof ele === 'object' && ele.removeAttribute !== undefined) { + if (typeof ele.removeAttribute === 'function') { ele.removeAttribute('data-reactroot'); } });