Skip to content

Interop: Allow me to mark a member as JS-only #27694

@nex3

Description

@nex3

Sometimes my needs for a JS API don't match up perfectly with my needs for a Dart API, and I'd like a way to control the shape of my JS API without negatively affecting the Dart API. A way to indicate that a member is only intended for use in JS would go a long way towards making this possible.

I propose that we add an annotation to package:js, perhaps @jsOnly, to indicate this. The analyzer and dev compiler would error if a JS-only member was used in Dart, and it would be an error to annotate an override method as JS-only. It would probably be fine if they were accessible via dynamic dispatch or mirrors, though. Dartdoc also wouldn't emit documentation for JS-only methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions