-
Notifications
You must be signed in to change notification settings - Fork 1
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
Upstream types from query-client and use a new magic type for deep casting #75
Conversation
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.
Amazing work thank you, this change will definitively improve our whole codebase, and I hope it will also improve the frontend's build problems 😍
An issue I have when using the |
b4969f5
to
511316b
Compare
21f8d8a
to
8d53169
Compare
4268cec
to
ba7d1ca
Compare
The issue I faced with types resolving to |
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.
Overall LGTM 🦖 Thank you for your work! I think it's really nice to let the type system do the heavy lifting instead of writing boilerplate code and having weird casts 😄
I've left a bunch of comments, let me know what you think or if you have any question. Not all of them require changes, feel free to decide on what's relevant
export const getFileExtra = < | ||
U extends LocalFileItemExtra | ImmutableCast<LocalFileItemExtra>, | ||
>( | ||
extra?: U, | ||
): U[ItemType.LOCAL_FILE] | undefined => extra?.[ItemType.LOCAL_FILE]; |
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.
Very cool, I didn't know that T
and immutable.Record<T>
would resolve to the same value type when using the same property access pattern (though it makes sense) 😅
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.
Actually it allows the use of this method in immutable and non-immutable world, with the output being immutable when the input was and vice-versa (not sure it was what you meant 😄 ). This was allowed by the work that we did to be able to access properties of records without the .get()
method (still a mystery to me to this day).
This PR adds a
frontend
entry-point that exposes the types used by the frontends (derived from backend types with immutable sugar coating).closes #74