-
-
Notifications
You must be signed in to change notification settings - Fork 44
fix(typescript): fix query typings #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,12 @@ import { Matcher, MatcherOptions } from './matches'; | |
|
||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; | ||
|
||
export interface SelectorMatcherOptions extends MatcherOptions { | ||
export type SelectorMatcherOptions = Omit<MatcherOptions, 'selector'> & { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you help me understand what this one does? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous one tried to extend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it, thanks 👍 |
||
selector?: string; | ||
} | ||
}; | ||
|
||
type ReactTestInstance = { | ||
getProp: (string) => NativeTestInstance; | ||
getProp: (str: string) => NativeTestInstance; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you make this something more descriptive of what this is? Like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. This is just a syntax error. You need to use type and name together. https://www.typescriptlang.org/docs/handbook/functions.html#writing-the-function-type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, can we make the name of the argument |
||
}; | ||
|
||
export type NativeTestInstance = Omit< | ||
|
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.
I think this may be backwards. A query only takes a NativeTestInstance, never a ReactTestRenderer.
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.
Oh I just thought testRenderer should be
ReactTestRenderer
by seeing these changes.manakuro@d8c3b30#diff-0da64c26f363af99c40bbae0dc3fb0bfR8
Should it be replaced with
NativeTestInstance
intypings/queries.d.ts
like this ?and Query just takes
NativeTestInstance
?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.
Yep this is right. And to make it more clear, we might want to change the name of the argument from
testRenderer
as a part of this as well 👍