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
Add an IdentifiedRef.get() alias for unwrap #304
Comments
There is load method already that does the very same thing. We could consolidate this to the get method, but personally I think it is better to have 2 methods as they are doing different things (although with same result). I can imagine keeping unwrap and get methods while dropping load method. But as v3 is just released... :) I am definitely keeping unwrap, as that will be the only sync method. Enhancing get method functionality is technically not a problem, I think I am fine with that. |
Ah, to clarify, Which yes, would mean the Basically I'm using (...I'd be tempted to suggest that the current |
Hmmm that does not sound like a good idea to me, maybe the method name would fit better, but having both sync/async method might cause a lot of confusion. In the whole ORM there is only one method that follows this pattern (being sync/async based on parameter), which is Generally speaking having multi purpose methods feels a bit like a code smell, it makes the code unnecessary complex - that is the reason why I introduced both
I am not in favour of having Also having Thoughts @lookfirst @pepakriz @vimmerru ? |
Right, I very much agree, I was just offering it as a suggestion if: a) the
Agreed.
True. As a sort of field report, what I'm personally finding is that putting So my thought was that, just like And so now I'm just very minorly complaining that |
Right, I was also thinking about adding validation there (which would be a BC too). What about a new method, like Then we can rename things in v4, I would like to get there much faster, v3 ended up as much fatter release than I was planning. I am already thinking about requiring TS 3.7 and node 10, and also about splitting the ORM into multiple packages. |
Cool, that all sounds reasonable. Thanks! |
Node 10 and always latest TS, is fine with me. TS moves so quickly and has been very backwards compatible that I don't see an issue with requiring it. |
nice... |
With
IdentifiedRef
, I'm finding it common to doproject.someRelation.unwrap()
(as long as the relation is already init'd). It seems likeproject.someRelation.get()
would be more idiomatic, and similar toproject.someCollection.getItems()
.Granted, there is a
get(key: K)
(or what not) method right now, so that name is "taken", however TypeScript does support declaring multiple type declarations for a single method, soget
could returnT
if given no args, andT[K]
ifkey
is present.Does that seem okay?
The text was updated successfully, but these errors were encountered: