Skip to content
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

[dart:js_interop] Warn that @anonymous and @staticInterop don't do anything on extension types #55581

Open
srujzs opened this issue Apr 27, 2024 · 0 comments
Assignees
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-js-interop Issues that impact all js interop

Comments

@srujzs
Copy link
Contributor

srujzs commented Apr 27, 2024

@anonymous was meant for JS interop classes that represent an arbitrary object. Historically, it was needed in order to make a difference in how JS interop classes are typed by the compiler. Today, the only difference it makes is allow users to use named argument constructors that create object literals instead of named constructors.

With interop extension types, this is no longer needed. Any external constructor (factory or otherwise) that has at least one named argument is considered an object literal constructor: https://dart.dev/interop/js-interop/usage#interop-type-members. Therefore, we should warn that this annotation does nothing on extension types.

Similarly, @staticInterop also does nothing on extension types. Extension types by definition can only use static dispatch.

@srujzs srujzs added web-js-interop Issues that impact all js interop area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels Apr 27, 2024
@srujzs srujzs self-assigned this Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

1 participant