Skip to content

Migrate Label to TypeScript - #976

Merged
colebemis merged 5 commits into
mainfrom
cb/ts-label
Jan 21, 2021
Merged

Migrate Label to TypeScript#976
colebemis merged 5 commits into
mainfrom
cb/ts-label

Conversation

@colebemis

@colebemis colebemis commented Jan 20, 2021

Copy link
Copy Markdown
Contributor

This PR migrates the Label and LabelGroup component to TypeScript as part of the TypeScript refactor.

@vercel

vercel Bot commented Jan 20, 2021

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/cy2wmfyae
✅ Preview: https://primer-components-git-cb-ts-label.primer.now.sh

@colebemis colebemis mentioned this pull request Jan 20, 2021
53 tasks

@emplums emplums left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Quick question - are we still planning on removing all the prop types once the refactor is done? Is there any harm to keeping them in there so that non TS users at least get console warnings when a prop is used incorrectly? or is it more of a maintenance issue because we'd have to keep both in sync?

Comment thread src/Label.tsx
const Label = styled('span')`
const Label = styled.span<
{
variant?: 'small' | 'medium' | 'large' | 'xl'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know you could do this syntax! Nice! 🙌

@colebemis

Copy link
Copy Markdown
Contributor Author

@emplums

are we still planning on removing all the prop types once the refactor is done? Is there any harm to keeping them in there so that non TS users at least get console warnings when a prop is used incorrectly? or is it more of a maintenance issue because we'd have to keep both in sync?

Yeah, the maintaince cost of keeping the TypeScript types and propTypes in sync is pretty high. I've noticed that most of our propTypes are actually inaccurate right now. I don't think the benefits of runtime console warnings out weight the maintaince cost of keeping TS and propTypes in sync.

@changeset-bot

changeset-bot Bot commented Jan 21, 2021

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 397a46f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@colebemis
colebemis merged commit 6500595 into main Jan 21, 2021
@github-actions github-actions Bot mentioned this pull request Jan 21, 2021
@joshblack
joshblack deleted the cb/ts-label branch January 19, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants