question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use the Polyfill with typescript?

See original GitHub issue

Hello,

I’m trying to use the polyfill with typescript, but I get the following errors which seems to me that the polyfill doesn’t have a typescript declaration file.

TypeScript error in Reader.tsx(2,33):
Could not find a declaration file for module 'react-resize-detector/build/withPolyfill'. '/node_modules/react-resize-detector/build/withPolyfill.js' implicitly has an 'any' type.
  Try `npm install @types/react-resize-detector` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-resize-detector/build/withPolyfill';`  TS7016

    1 | import React, { useCallback, useMemo, useState } from 'react';
  > 2 | import ReactResizeDetector from 'react-resize-detector/build/withPolyfill';
      |                                 ^
    3 | 

Could also https://github.com/maslianok/react-resize-detector/pull/137 be merged and released? Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
maslianokcommented, Mar 11, 2021

Should be fixed in 6.6.3

1reaction
maslianokcommented, Mar 1, 2021

Please, try v6.6.1.

It should work now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I need a polyfill with Typescript? - Stack Overflow
The TypeScript compiler levels down the syntax (recognizable by special characters like => , ? , ` , # and keywords like class...
Read more >
Adding Polyfills in TypeScript App - MyDatahack
A polyfill is code that fills in functionality missing from the older browser. For example, Internet Explorer does not have Promise like ...
Read more >
TARGET, LIB and POLYFILL for TypeScript and ... - YouTube
# TypeScript options that control desired ; #JavaScript runtime support. We will look at the ; #target compiler option, then the ; #lib...
Read more >
ts-polyfill - npm
Runtime polyfills for TypeScript libs, powered by core-js! ... Start using ts-polyfill in your project by running `npm i ts-polyfill`.
Read more >
Import polyfill using dynamic imports in TypeScript
Polyfills are often pasted from the internet, so you can use JavaScript or TypeScript depending on the source. Then, you can import them ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found