-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Uncaught TypeError: 'JSArray' is not a subtype of type 'List<ResizeObserverEntry>' #36798
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
Comments
@kenzieschmoll @rakudrama – moved to SDK |
I updated the code snippet to show the entirety of the observer code. |
One thing to note here, the
The problem remains either way. Opened flutter/devtools#966 to remove unnecessary |
What got lost in the initial bug description is we were writing the code in that strange way to workaround a bug in dart:html. |
What was the bug? |
The dart:html code had a bug where it required a JS function rather than a Dart function. @terrylucas may have fixed that at some point. |
On the original issue, it looks like we fixed some signatures to take Maybe |
What is the status of this issue? I have something that looks similiar with the latest dart sdk v2.6.1. Code Snippet: @override
void ngOnInit() {
_resizeObserver = ResizeObserver((List<ResizeObserverEntry> entries, ResizeObserver observer) {
if(_chart != null) {
try {
_chart.resize();
} catch(error) {
log.warning("Unable to resize _chart because $error");
}
}
});
_resizeObserver.observe(chartRef);
} As I said, the above works fine with dartdevc, but with dart2js it fails with the following error each time the window size changes.
I apologize for the minified code. I have been unable to force My code is not using EDIT |
Thanks for following up! Indeed it appears like that case was accidentally omitted. I sent https://dart-review.googlesource.com/c/sdk/+/127500 to include it too. |
@kenzieschmoll commented on Mon Apr 29 2019
I have some resize observer code that looks as follows:
And in the dart2js version of the web app, I am getting a TypeError. I do not get this error when using
webdev serve
.@rakudrama commented on Mon Apr 29 2019
Can you show more of the code, especially something declared with the list type in question?
JavaScript arrays coming from JS-interop are currently considered by dart2js to implement
List<dynamic>
, which is not assignable toList<ResizeObserverEntry>
.I don't think this is really a html issue so much as a JS-interop issue.
There is an issue to improve these JS-interop issues:
#35084
And a proposal:
https://github.com/dart-lang/sdk/blob/js_interop/pkg/js/proposal.md
The text was updated successfully, but these errors were encountered: