-
Notifications
You must be signed in to change notification settings - Fork 132
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
TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. #35
Comments
Typescript is telling you that it does not know that the imported You can overcome this by explicitly declaring the type as
|
@nikolovp You need to use the default export of the import ResizeObserver from 'resize-observer-polyfill';
//... |
@que-etc This is the first thing I actually did but in that case ResizeObserver is undefined so I tried with importing everything as ResizeObserver and I finally got the construct function but I cannot instantiate it without workarounds like the one mentioned by @ablamunits. |
@nikolovp Please, add {
"compilerOptions": {
// ...
"esModuleInterop": true
}
} |
I didn't know about this compiler options. It works now. Thanks a lot! |
Hi, I am new to typescript and I hit a problem with resize-observer-polyfill.
When I try to make an instance of ResizeObserver I get:
TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
The error sounds like the ResizeObserver type doesn't have a construct(or) signature.
Example code:
And my typescript configuration:
Thanks!
The text was updated successfully, but these errors were encountered: