-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: add AbortController
to the terminal types list
#47
fix: add AbortController
to the terminal types list
#47
Conversation
@Papooch do you mind adding the label |
Thanks! Do you think that fix eliminates the need for the
I added the |
Hm, it should not expand on the string methods 🤔. Does it also happen without your changes? Also I'm wondering if we just put a constuctor type ( |
ok so without the changes I've made. I add that to the |
Hmm. I think we need to take a decision here. Even if you define all properties of the ClsStore as required, you can still get undefined when you try to retrieve them, if you don't populate all of them before accessing. So if the types were to be 100% correct, then every Having an explicit nullable property in the store is something I didn't consider, but it makes sense actually. I'm prety sure there's some typescript trickery that will still allow generating the paths for the nested properties, but make the return type nullable. At the same time (and that's for a separate issue), we should never generate paths inside classes. |
good point. Here's the project (patched) that I'm playing with: https://gitlab.com/micalevisk/nestjs-cls-issue-46 just run I'll try to make them return |
since nestjs-cls/src/lib/cls.service.ts Line 60 in d09c8e8
|
Another approach to avoid typing non-null assertions would be the same used in I can't think on anything other than those two :/ |
now we have |
Sorry for taking too long to respond, I finally found some time to look into it. I am actually fine with adding As far as this PR goes, I think we can just merge it (unless you want to do some polishing) and address the other things in separate issues.
I don't really believe in 100% type correctness at the expense of usability. As I said, this would pollute the code with null checks which add little value if your app is built around having stuff in the context. I'm more inclined towards your other suggestion with the However, either of these approaches deal with the possibility of nullable properties in the The typing of |
oh, I misunderstood you before. Now I got it that the I'll revert that so we could merge this now as a hot fix. And I'll try to improve the solution around your thoughts later, is it ok for you? |
RecursiveKeyOf
has found any
AbortController
to the terminal types list
I mean you didn't really have to remove the "stop if we found any". If anything, it prevent the error, which is nice. What I meant was that it was undesirable to generate paths inside AbortController, hence the suggestion to add it to TerminalType. |
I've made this change on
@nestjs/config
: nestjs/config#907 I found that it closes #46 as well