-
Notifications
You must be signed in to change notification settings - Fork 119
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
The On
bit for JSObject
displays as JSObjectRepType
which is weird
#3684
Comments
Just double checked this at https://api.dart.dev/main/6e04dd49de2a8fec876cc9d288a6d7b559a715f2/dart-js_interop/JSObject-extension-type.html Not there...yet... |
To be clear, this MAY just be due to the SDK type. Things are fixed with pkg:web |
this includes dartdoc at eed92d3 am I reading this wrong? |
Hey Kevin, sorry this isn't fixed. What do you expect this to say? Given this code: // interceptors.dart
class JSObject { ... }
// js_types.dart
typedef JSObjectRepType = interceptors.JSObject;
// js_interop.dart
extension type JSObject._(JSObjectRepType _jsObject) implements JSAny { ... } The representation type of We do have some mechanisms for working around "package internal" types. Like if class I think there are a few principles we should not depart from though:
|
We should maybe chat with @srujzs and/or @sigmundch about how to deal with these types. If we should special-case or what |
There are two separate cases here (and one of them may be addressed already - I can't tell since it's not on the website yet :)):
One proposal to address that was that since the representation field is "private" (starts with an underscore), that may be a signal to the docs to not show the representation type. That determination may make sense here but not elsewhere. Another option is just not showing the representation type for these specific SDK types as they're likely to confuse users.
For these types, you're always using some other mechanism to get an instance, and users can never use the representation type as they're declared in a private library and never exported. Of course, that distinction is very specific to these types and may not make sense for any other extension type. Realistically, I don't feel strongly enough about not showing the representation type for these types and care more about 2.
|
An interesting piece about (2), is that it may be more intuitive in general for all extension types, outside the js-interop realm. For example, if you have: extension type F(int x) {}
extension type G(F f) {} I'd prefer |
Agree with @srujzs 's and @sigmundch 's comments above 😁
I don't think this fits. If I make the representation field private, that just means that external libraries cannot access it, and is orthogonal to whether the representation type should be documented. In fact, I have to imagine that the guidance for a representation field is the same as any other instance field: Make it private unless it is necessary (or some level of useful) outside the library. So most (the vast majority of?) representation fields should be private. Regardless of whether it is intended that they are public constructable. If we want special signals that say "not constructable! don't document the rep type!", we can make that. Since this is all in the |
Agreed, it seems like it might be a bad fit. The representation type is always visible in the type signature, and that should be a separate determination from the field name. An annotation might be nice, but it might make sense to wait here before implementing anything like that. While showing the representation types for |
Sounds good! |
See https://pub.dev/documentation/web/0.5.0/web/HTMLElement-extension-type.html
Also!! the
on
bit forHTMLElement
is meant to be ~hidden.Either way,
JSObjectRepType
is certainly not what we want!The text was updated successfully, but these errors were encountered: