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

Strongly typing a SharedMap #8520

Closed
kevindiclemente opened this issue Dec 9, 2021 · 6 comments
Closed

Strongly typing a SharedMap #8520

kevindiclemente opened this issue Dec 9, 2021 · 6 comments
Labels
area: dds Issues related to distributed data structures feature-request New feature or requests status: stale
Milestone

Comments

@kevindiclemente
Copy link

Feature

Is your feature request related to a problem? Please describe.
It's not currently clear how to add strong typing to SharedMap. Such as key: string -> SharedCell<number>

Describe the solution you'd like

Declare a SharedMap using generics, like with SharedCell; where SharedCell<string> we could have SharedMap<string, string>

Existing work

Not aware of it

Describe alternatives you've considered

Having weak typing, which is error prone, or adding a wrapper class around SharedMap.

Additional context

@ghost ghost added the triage label Dec 9, 2021
@kevindiclemente kevindiclemente changed the title Add strong typing to SharedMap Strongly typing a SharedMap Dec 9, 2021
@tylerbutler
Copy link
Member

@ChumpChief @skylerjokiel I think we've investigated this in the past, but I don't know where we landed. Thoughts?

@tylerbutler tylerbutler added the area: dds Issues related to distributed data structures label Dec 9, 2021
@ChumpChief
Copy link
Contributor

This is same as #363 / #1239 / #136 -- currently resolved as won't fix but could be considered.

@tylerbutler tylerbutler added the feature-request New feature or requests label Dec 15, 2021
@kevindiclemente
Copy link
Author

If you want to hear from a customer about why typing is important, please let me know. Same reason we use typescript instead of Javascript.

@tylerbutler
Copy link
Member

@kevindiclemente Are you always storing the same type of object in the map? Today SharedMaps can store values of heterogeneous types, so I'm wondering if you're using that capability, or foresee needing it.

@tylerbutler tylerbutler added this to the Next milestone Jan 13, 2022
@ghost ghost removed the triage label Jan 13, 2022
@AndrewCraswell
Copy link

AndrewCraswell commented Jun 21, 2022

Even if the consumer plans to store multiple types, the SharedMap could still be typed in such a way as to clearly determine which types are expected. TypeScript doesn't have to force a single type. In most cases, the type could default to any, but allow the dev to define tighter types.

The lack of proper types has been one of the first difficult aspects of onboarding to Fluid Framework that I encountered. It's not consistent with what I would expect from a client-side library in this regard. I ended up writing my own wrapper classes around the DDS types to add better type handling.

@ghost ghost added the status: stale label Dec 18, 2022
@ghost
Copy link

ghost commented Dec 18, 2022

This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!

@ghost ghost closed this as completed Dec 27, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds Issues related to distributed data structures feature-request New feature or requests status: stale
Projects
None yet
Development

No branches or pull requests

4 participants