-
Notifications
You must be signed in to change notification settings - Fork 7
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
Running type tests on CI #93
base: master
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
I think I will run these as standard |
listener(event: MouseEvent) { | ||
const value: number = event.button; | ||
listener(event) { | ||
expectTypeOf(event).toEqualTypeOf<MouseEvent>(); |
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.
@Andarist this is currently failing as event
is being inferred by TS as any
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.
Any suggestion on how to resolve this?
export type Listener<TTarget extends EventTarget, TEvent extends Event> = | ||
| ListenerObject<TEvent> | ||
| { (this: TTarget, ev: TEvent): void }; | ||
export type Listener<TTarget extends EventTarget, TType extends string = string> = |
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.
@Andarist I am keen for your thoughts here. I
moved Listener
back to taking a string
rather than an Event
in order to maintain the previous type signature. Autocomplete seems to be continuing to work great.
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.
After this change the only breaking change would be the type signature of bindAll
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.
Or this is bad because we have separate calculating of what TEvent
is, rather that a single inference at the root? 🤔
With all my type changes reverted, i am currently getting the |
Hey @Andarist it looks like the type tests I setup are now failing as a part of #44. I will have a go at fixing them