-
Notifications
You must be signed in to change notification settings - Fork 548
refactor(presence): Create branded JsonDeserialized type #24641
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
base: main
Are you sure you want to change the base?
Conversation
* @system | ||
*/ | ||
export declare class JsonDeserializedBrand<T> { | ||
private readonly JsonDeserialized: JsonDeserialized<T>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably drop the JsonDeserialized<T>
. Just T
is probably enough. Probably want to use the dummy accessor and iterator found in that reference PR's brand classes.
const unbrandedValue = fromJsonDeserializedHandle(item.value); | ||
callbackfn(asDeeplyReadonly(unbrandedValue), key, this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably combine both of these pass-through helper functions.
const data = this.value.items[key]?.value; | ||
return data === undefined ? undefined : asDeeplyReadonly(fromJsonDeserializedHandle(data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of silly since those are both pass through anyway - should be able to adjust the helper to handle it.
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
Updates the presence internals to use a branded internal type when passing around JsonDeserialized objects. There are two functions to brand and unbrand a JsonDeserialized object.
Externally, the API remains the same; the internal types and functions are marked
@system
and objects are converted between the types at the API boundaries.