Skip to content

[js_interop] No error to tear off the primary construcror of a JS ointerop type #61286

@sgrekhov

Description

@sgrekhov

Thanks to @eernstg for pointing on this. There's no error if a primary constructor of a JS interop type is torn off.

For example there is no expected errors in the test below.

import 'dart:js_interop';

extension type ET._(JSObject _) implements JSObject {
}

@JS("ET")
extension type ET2(JSObject _) implements JSObject {
}

extension type ET3.p(JSObject _) implements JSObject {
}

main() {
  var c1 = ET._;
//         ^^^^^
// [analyzer] unspecified
// [web] unspecified

  var c2 = ET2.new;
//         ^^^^^^^
// [analyzer] unspecified
// [web] unspecified

  var c3 = ET3.p;
//         ^^^^^
// [analyzer] unspecified
// [web] unspecified
}

cc @srujzs
Dart SDK version: 3.10.0-edge.9f2218e4509210576abecc79d7184c94a3ad0e26 (main) (Fri Aug 8 20:46:19 2025 -0700) on "linux_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    web-js-interopIssues that impact all js interop

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions