-
Notifications
You must be signed in to change notification settings - Fork 265
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
type WidgetExampleAttribute
#1066
Conversation
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.
Better 👌
@@ -32,7 +31,7 @@ | |||
export let outputJson: string; | |||
export let applyInputSample: (sample: TWidgetExample, opts?: ExampleRunOpts) => void = () => {}; | |||
export let validateExample: (sample: WidgetExample) => sample is TWidgetExample; | |||
export let exampleQueryParams: QueryParam[] = []; | |||
export let exampleQueryParams: WidgetExampleAttribute[] = []; |
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.
It would be even better if the type was tied to the concrete TWidgetExample
@@ -108,3 +108,7 @@ export type WidgetExample<TOutput = WidgetExampleOutput> = | |||
| WidgetExampleTableDataInput<TOutput> | |||
| WidgetExampleZeroShotTextInput<TOutput> | |||
| WidgetExampleSentenceSimilarityInput<TOutput>; | |||
|
|||
type KeysOfUnion<T> = T extends any ? keyof T : never; |
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.
Isn't this just keyof T
?
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.
they are different. In keyof T
case, ts errs
merging it now. Might make the typing even stronger in subseq PR |
Follow up to #1023
This PR renames some typing to be more clear. Check out the files tab