-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interopIssues that impact all js interop
Description
Now the folllwong test is passing, no error or warning occurs
import 'dart:js_interop';
import 'dart:js_interop_unsafe';
import '../../../Utils/expect.dart';
import '../js_utils.dart';
String log = "";
@JSExport()
class C {
int variable = 42;
String method(String v) => "method($v);";
String get getter => "Some getter";
void set setter(bool value) {
log = "setter($value);";
}
}
@JSExport()
typedef CAlias = C;
void main() {
var c = CAlias();
var jsC = createJSInteropWrapper<CAlias>(c);
globalContext["jsC"] = jsC;
eval(r'''
globalThis.v1 = globalThis.jsC.variable;
globalThis.v2 = globalThis.jsC.method('x');
globalThis.v3 = globalThis.jsC.getter;
globalThis.jsC.setter = false;
''');
Expect.equals(42, (globalContext["v1"] as JSNumber).toDartInt);
Expect.equals("method(x);", (globalContext["v2"] as JSString).toDart);
Expect.equals("Some getter", (globalContext["v3"] as JSString).toDart);
Expect.equals("setter(false);", log);
}It makes sense to expect a warning on typedef annotaded with @anonymous if it is technically possible.
Metadata
Metadata
Assignees
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interopIssues that impact all js interop
Type
Projects
Status
No status