-
Notifications
You must be signed in to change notification settings - Fork 81
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
Make EmitterWebhookEventName
readonly
#491
Comments
We've actually already got a PR open for this, but the issue is it requires us to do some nasty looking casting or otherwise add additional runtime code that is effectively a no-op.
🤦 duh course you will, you're passing a non-mutable type into a mutable one I'll try and have a look into that sometime in the next couple of days. |
@G-Rath, heh, I'm 95% sure that I got here by looking at the code that @jablko wrote which is likely how he got to the same place... (The code did a nasty And yes, the convenient thing about |
I agree it'd be nice, but like I said currently it's requiring a pretty ugly cast that I can see causing trouble on our side down the line, but I'll try and find some time to look into it. For now you should be able to just do something like |
@G-Rath what can we do here right now? Is this issue blocked by something right now? |
would you suggest to close this issue then as won't fix? Or shall we leave it open and try again in future? |
It's not clear why the casting is unsafe? |
I'd very much appreciate an explanation for
Better how? And better for users of |
Also, AFAICT, the casting done in @jablko's PR is safe since the input type itself requires a readonly input; and I don't think that there should be a downside for that. I agree that it's ugly, but cases like ours show that not doing it is just pushing the same ugliness on users of this code... Assuming that bugs eventually get fixed, I think that it makes sense to use the patch (in the PR that you closed), with a comment to remove the hack once the underlying problem gets fixed. |
What’s missing?
Methods like
.on
and.removeListener
useevent: E | E[]
, it would be nice to change it toevent: E | readonly E[]
, since it's convenient to have anas const
list of event names (which currently get a type error when passing it to anE[]
argument).Why?
Makes TS code better.
Alternatives you tried
The text was updated successfully, but these errors were encountered: