-
Notifications
You must be signed in to change notification settings - Fork 26
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
add type for component #5
Conversation
src/index.d.ts
Outdated
args_0: | ||
| string | ||
| TemplateStringsArray | ||
| CSSAttribute | ||
| (( | ||
props: P & { | ||
theme?: any; | ||
as?: string | number | symbol | undefined; | ||
className?: any; | ||
children?: any; | ||
} | ||
) => string | CSSAttribute), | ||
...args_1: ( | ||
| string | ||
| number | ||
| (( | ||
props: P & { | ||
theme?: any; | ||
as?: string | number | symbol | undefined; | ||
className?: any; | ||
children?: any; | ||
} | ||
) => string | number | CSSAttribute | undefined) | ||
)[] |
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.
The types of the arguments are exactly the same as above.
Should I create new types and replace them?
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.
Yeah that's probably better. I very hastily ported these because Goobers types didn't play nice with ours but it was mostly copy and paste. I appreciate you taking the time to clean this up.
props: P & | ||
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.
T & P
added component's props to use them in the styling function without specifying the type.
export declare function styled<T extends keyof JSX.IntrinsicElements>( | ||
tag: T | ((props: JSX.IntrinsicElements[T]) => JSX.Element) | ||
): <P>( | ||
type Tagged<T> = <P>( |
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.
return type of the styled
function
Thank you |
Added a type of
styled()
to accept Components.ref #2 (comment)