Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't expose global ResizeObserver #44

Closed
yesmeck opened this issue Dec 3, 2018 · 3 comments
Closed

Don't expose global ResizeObserver #44

yesmeck opened this issue Dec 3, 2018 · 3 comments

Comments

@yesmeck
Copy link

yesmeck commented Dec 3, 2018

We've received bug reports that TypeScript complaints Cannot find name 'ResizeObserver'.#13405. Here is the code shows how we use ResizeObserver.

I found that TypeScript removes the import ResizeObserver from 'resize-observer-polyfill' statement when generating declaration file. Here is the generated declaration file https://unpkg.com/antd@3.11.0/lib/input/TextArea.d.ts

The reason I guess is ResizeObserver was exposed as a global interface, not sure if it's a bug of TypeScript. But as #37 (comment) said, this library is actually a ponyfill, so there is no need to expose ResizeObserver as global right?

@weswigham
Copy link
Contributor

Alternatively, include the interface in the export~

weswigham added a commit to weswigham/resize-observer-polyfill that referenced this issue Dec 4, 2018
@que-etc
Copy link
Owner

que-etc commented Dec 9, 2018

Fixed in v1.5.1.

@ndbroadbent
Copy link

ndbroadbent commented Dec 14, 2018

Hello, I am still getting this type error with version 1.5.1. See: ant-design/ant-design#13405 (comment)

Could this be a problem with my tsconfig.json?

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "es5",
      "es2015.promise",
      "es2015.symbol",
      "es2015.collection",
      "esnext.array"
    ],
    "allowJs": true,
    "skipLibCheck": false,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve"
  },
  "include": ["src"]
}

EDIT: Sorry, false alarm. This was fixed when I upgraded to antd version 3.11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants