Open norbornen opened 5 days ago
Thank you for the issue, there is already an ongoing PR in the form of #16 about adding a relation wrapper. I didn't have time so far to look over the implementation but I will try to do it in the following days.
It turned out to be a smaller change than expected, I added this in #18. Feel free to test it and I'll put out a new patch version in the following days.
Thank for your answer!
pr18 good work for OneToOne relation, but I'm a little confused by the fact that he expects type Relation<Other | null>
, while it seems more appropriate to use type Relation<Other> | null
(and Relation<Other>[] | null
for Many).
pr18 not work for OneToMany relation:
And, just so you know, the plugin does not work correctly if "strictNullChecks": false
in project. I am sure that this is the problem of those who use it, but I think it would be right to write this to README.
Thanks for testing!
As for the order of the wrapper, I've chosen somewhat arbitrarily Relation<T[]>
, mostly based on this Stack Overflow thread. I couldn't find anything in the TypeORM docs, so I just used this answer. If you can point me towards any official suggestion, I'll change it.
I tried with OneToMany
, it seems to be working to me. Your problem might be that if you misspell the name, it won't be added to the suggestion either: d: Relation<Aaa>
will suggest d: Relation<Aaa[]>
correctly.
For strictNullChecks
, I wasn't able to reproduce it. Can you send me a tsconfig or anything that makes it break with the example configuration? Assuming this is a real problem, I'm not sure how to deal with it. I'll probably follow your advice and add a note to the README... without strict null-checking, this is mostly a cosmetic library.
Hello!
Can u add support for this case:
https://github.com/typeorm/typeorm/issues/4526#issuecomment-1076462998
This is the correct description of the column, but the linter reports an error:
Thank you for your work!