JS interop can't create anonymous objects with keys that are Dart keywords #60666
Labels
area-web-js
Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop
web-js-interop
Issues that impact all js interop
The set of reserved keywords in JS isn't exactly the same as in Dart, and numerous keywords that aren't allowed as instance member names in Dart are allowed in JS. This means that JS APIs not-infrequently use these names for options objects. The name
default
in particular is a keyword in Dart and a likely option in JS APIs.Currently, Dart's JS interop can't easily construct options objects that use these keyword-style option names. I'd expect the following to work:
But this example demonstrates that the object is actually constructed with a field named
defaultValue
, notdefault
, despite the@JS
annotation:The text was updated successfully, but these errors were encountered: