-
Notifications
You must be signed in to change notification settings - Fork 536
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
Demonstrate replacing IFluidObject with unknown and using queryObject fn for feature detection #3238
Conversation
I feel like I'm the main one arguing with you about this. :( I'm not opposed to this syntax. It is a tiny bit more verbose than I'd like, but I can get used to it. |
Nit: is there a way to get it more like |
@tylerbutler You're just first to the gate ;) The verbosity is a feature, btw. |
Not really. If you cast it first you can do Note that this is a bit of a step backwards, see https://github.com/microsoft/Prague/issues/2910 |
examples/data-objects/external-component-loader/src/externalComponentLoader.tsx
Outdated
Show resolved
Hide resolved
Ok after further discussion with @curtisman and @anthony-murphy and others on the team, I'm planning to update this proposal like so:
Names of all these things are totally up for grabs, just starting somewhere. Note that these changes are all type-level and won't change runtime behavior. Also note that this doesn't attempt to address #2566 after all, but may change the symptom if using the agnostic |
I don't think I like the existence of the Can you restate the problem that you are trying to solve? I am still unclear what the benefits are (at least it is not apparent to me just reading the change). Is it because the whole syntax doesn't contain the word "query" in it? In general, I like the return value with a type that is the least generic as possible. Returning IFluidObject at least have some indication of where it could go, but just a plan unknown/object gives no type indication at all. |
Thanks @curtisman, good feedback. I've opened an issue where I tried to state the motivation better and describe the proposal there. I responded to Curtis's feedback there. Closing this PR out for now. PS - I will drop |
This is collateral for a post I made in Teams, about using different syntax for feature detection that is hopefully more self-descriptive and easier to learn/understand.
The gist is to change
(obj as IFluidObject).IFoo
toqueryObject(obj).IFoo
, and replace the typeIFluidObject
withunknown
throughout. And new interfaces you want to be able to query get registered to a type calledFluidDataInterfaceCatalog
. See the core changes here, the rest is updating usages.It's an incomplete change, but shows a few different places that IFluidObject appears and how it could be changed.