Skip to content

[dart:js_interop] ExternalDartReference should have a generic argument. #55536

Closed
@ykmnkmi

Description

@ykmnkmi
// There are also JS typed arguments and fields, used on the JS side, that accept null values.
extension type AppProperties._(JSObject _) implements JSObject {
  // So, I can't use checks like this
  factory AppProperties({void Function(({String text}))? message, int? optional}) {
    if (optional == null) {
      return AppProperties.__(message?.toExternalReference);
    }

    return AppProperties.__(message?.toExternalReference, optional: optional.toJS);
  }


  // No type check, can pass reference to anything.
  external factory AppProperties({ExternalDartReference? message});

  @JS('message')
  external ExternalDartReference? _message;

  void Function(({String text}))? get message {
    return _message?.toDartObject as void Function(({String text}))?;
  }
}

Metadata

Metadata

Assignees

Labels

area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions