Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.

Bug in a TypeScript Project #11

Closed
YannickLeRoux opened this issue Nov 21, 2018 · 6 comments
Closed

Bug in a TypeScript Project #11

YannickLeRoux opened this issue Nov 21, 2018 · 6 comments

Comments

@YannickLeRoux
Copy link

I am in the process of migrating my portfolio from a regular CRA application to a CRA-typescript app.

I am having issue with this LazyHero, as the background image is not displayed and this error pops up in the console:

LazyHero.js:167 Uncaught TypeError: Cannot read property 'offsetHeight' of undefined
    at LazyHero.updateSize (LazyHero.js:167)
    at Image.image.onload (LazyHero.js:156)

I am new to TypeScript so it might be a problem with type declarations (maybe not). I just added a simple declare module 'react-lazy-hero'; to have the app not crash, but might be not enough to have it work properly.
Any advice ?

@danistefanovic
Copy link
Owner

Would you be able to set up a reproduction repo? Thanks!

@YannickLeRoux
Copy link
Author

of course,
https://github.com/YannickLeRoux/portfolio-typescript

Thank you

@danistefanovic
Copy link
Owner

Please try to downgrade to styled-components v3.

@danistefanovic
Copy link
Owner

[email protected] should fix the issue.

@YannickLeRoux
Copy link
Author

That was it thank you!

@danistefanovic
Copy link
Owner

Awesome!

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

No branches or pull requests

2 participants