ant-design: Type error: Cannot find name 'ResizeObserver'.
- I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.11.0
Environment
MacOs10.13.5 (17F77)
Reproduction link
https://github.com/ant-design/ant-design/blob/master/components/input/TextArea.tsx#L46 Sandbox
Steps to reproduce
- create project
- npm install typescript antd …
- create index.tsx
- npm start
What is expected?
success to start dev server
What is actually happening?
Type error: Cannot find name ‘ResizeObserver’.
The compiled typings file antd/lib/input/TextArea.d.ts
no import ResizeObserver
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 34 (7 by maintainers)
The temporary fix is putting following interface to your
typings/index.d.ts
:Temp fix:
node_modules/antd/lib/input/TextArea.d.ts
import ResizeObserver from 'resize-observer-polyfill';
+1
Fixed by resize-observer-polyfill@1.5.1 https://github.com/que-etc/resize-observer-polyfill/pull/45
https://github.com/que-etc/resize-observer-polyfill/pull/45 fixes the polyfill’s types, but antd itself can be fixed by adding a
/// <reference types="resize-observer-polyfill" />
to the file (to make the dependency on the global patch explicit), as an alternative.