Skip to content
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 FormGroup to TypeScript #999

Merged
merged 4 commits into from
Feb 4, 2021
Merged

Migrate FormGroup to TypeScript #999

merged 4 commits into from
Feb 4, 2021

Conversation

colebemis
Copy link
Contributor

This PR migrates the FormGroup component to TypeScript as part of the TypeScript refactor.

@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2021

⚠️ No Changeset found

Latest commit: 2565a8e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Jan 28, 2021

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/im6tylh82
✅ Preview: https://primer-components-git-cb-ts-form-group.primer.vercel.app

@colebemis
Copy link
Contributor Author

This "component as namespace" pattern is difficult to type with styled-components.

image

Does have any ideas on how to type this? @smockle @bscofield @VanAnderson

@colebemis colebemis mentioned this pull request Jan 28, 2021
53 tasks
@smockle
Copy link
Member

smockle commented Jan 28, 2021

This "component as namespace" pattern is difficult to type with styled-components.
Does have any ideas on how to type this? @smockle @bscofield @VanAnderson

Oooh interesting problem! I do know a few ways we could type this; here are two options:

  1. https://github.com/primer/components/blob/30e5c4fc8ea4f4a10eb6cee823ea02e8ea54ac6c/src/FormGroup.tsx
  2. https://github.com/primer/components/blob/106012152af520ba72538a454065f098d3cb2ec5/src/FormGroup.tsx

@vercel vercel bot temporarily deployed to Preview February 1, 2021 22:15 Inactive
@vercel vercel bot temporarily deployed to Preview February 2, 2021 19:04 Inactive
@colebemis colebemis marked this pull request as ready for review February 2, 2021 19:11
@vercel vercel bot temporarily deployed to Preview February 2, 2021 19:11 Inactive
@colebemis
Copy link
Contributor Author

colebemis commented Feb 2, 2021

Found a simple solution to the namespace type issue using Object.assign:

export default Object.assign(FormGroup, {Label: FormGroupLabel})

@colebemis colebemis merged commit f81201d into main Feb 4, 2021
@colebemis colebemis deleted the cb/ts-form-group branch February 4, 2021 19:39
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