-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Migrate @storybook/addon-events to Typescript #7190
Migrate @storybook/addon-events to Typescript #7190
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-fork-lonyele-feature-migrate-addon-events.storybook.now.sh |
interface StyledTextareaProps { | ||
shown: boolean; | ||
failed: boolean; | ||
value?: 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.
Probably I missed something... but putting only ...rest
didn't work. I also had to add value
, onChange
which seems unnecessary.
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.
You can also use something like React.HTMLProps<HTMLTextAreaElement>
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.
Thanks, I'll try that!
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.
hm... It didn't work for me. Maybe I implemented in a wrong way?
@@ -67,7 +76,7 @@ const Label = styled.label({ | |||
textAlign: 'right', | |||
width: 100, | |||
fontWeight: '600', | |||
}); | |||
} 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.
This one also gives me errors and I couldn't resolve it. Error goes like this
Argument of type '() => { display: string; boxSizing: "border-box"; verticalAlign: string; paddingRight: number; paddingTop: number; textAlign: "right"; width: number; fontWeight: "600"; }' is not assignable to parameter of type 'TemplateStringsArray'.
Type '() => { display: string; boxSizing: "border-box"; verticalAlign: string; paddingRight: number; paddingTop: number; textAlign: "right"; width: number; fontWeight: "600"; }' is missing the following properties from type 'TemplateStringsArray': raw, concat, join, slice, and 16 more.ts(2345)
Changing code like this also didn't work
const Label = styled.label(() => ({
display: 'table-cell',
boxSizing: 'border-box',
verticalAlign: 'top',
paddingRight: 5,
paddingTop: 7,
textAlign: 'right',
width: 100,
fontWeight: '600',
}));
Similar code is already used at other parts
storybook/addons/a11y/src/components/Tabs.tsx
Lines 18 to 24 in 8aae29d
const HighlightToggleLabel = styled.label(({ theme }) => ({ | |
cursor: 'pointer', | |
userSelect: 'none', | |
marginBottom: '3px', | |
marginRight: '3px', | |
color: theme.color.dark, | |
})); |
storybook/lib/components/src/form/field/field.tsx
Lines 4 to 13 in 2887028
const Wrapper = styled.label(({ theme }) => ({ | |
display: 'flex', | |
borderBottom: `1px solid ${theme.appBorderColor}`, | |
margin: '0 15px', | |
padding: '8px 0', | |
'&:last-child': { | |
marginBottom: '3rem', | |
}, | |
})); |
sorry if there are so many questions! |
@gaetanmaisse think you could help here? |
|
@ndelangen oh... how come this happened. I |
…feature/migrate-addon-events
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.
LGTM!
Issue: #5030
What I did
I migrated addon-events to Typescript.
I wrote some comments where I think more attention is needed
How to test
If your answer is yes to any of these, please make sure to include it in your PR.