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

Initial config for TypeScript refactor #518

Closed
wants to merge 2 commits into from
Closed

Conversation

hleote
Copy link
Contributor

@hleote hleote commented Dec 12, 2019

Addresses #516

Purpose

  • Add initial config for refactoring components to TypeScript

Approach and changes

  • Added initial config files and partially refactored Button component to TypeScript

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@vercel
Copy link

vercel bot commented Dec 12, 2019

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

@codecov
Copy link

codecov bot commented Dec 12, 2019

Codecov Report

❗ No coverage uploaded for pull request head (refactor/typescript@599bdc0). Click here to learn what that means.
The diff coverage is n/a.

@@ -0,0 +1,65 @@
{
"compilerOptions": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: when we ship this, we can remove jsconfig.json (see #520) and merge its config into this file.

@connor-baer connor-baer changed the title Initial config for TypeScript refactor feat(configs): set up TypeScript Apr 4, 2020
@connor-baer connor-baer changed the title feat(configs): set up TypeScript Initial config for TypeScript refactor Apr 4, 2020
Copy link
Member

@connor-baer connor-baer left a comment

Choose a reason for hiding this comment

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

Hey @hleote! Thank you for opening this PR 🙌

I need TypeScript support in Circuit UI for a project soon and I had some time over the weekend, so I took your work as a starting point to configure Circuit UI for TypeScript: #563. I hope you don't mind :)

}

interface Props {
size: SIZE_PROP_TYPE // Size of the button. Use the Button's KILO, MEGA, or GIGA properties.
Copy link
Member

Choose a reason for hiding this comment

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

The comments need to remain this format so they can be picked up by react-docgen.

Suggested change
size: SIZE_PROP_TYPE // Size of the button. Use the Button's KILO, MEGA, or GIGA properties.
/**
* Size of the button. Use the Button's KILO, MEGA, or GIGA properties.
*/
size: SIZE_PROP_TYPE

primary: boolean // Renders a primary button using the brand color.
disabled: boolean // Should the Button be disabled?
secondary: boolean // Renders a secondary button. Secondary buttons look the same for primary (default) and flat buttons.
defaultProps: {}
Copy link
Member

Choose a reason for hiding this comment

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

This is not a prop type 😉

Comment on lines +101 to +103
Button.KILO = KILO;
Button.MEGA = MEGA;
Button.GIGA = GIGA;
Copy link
Member

Choose a reason for hiding this comment

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

Do you know how to type static properties on a function? I couldn't find anything when I googled it 🤔

@@ -0,0 +1,65 @@
{
"compilerOptions": {
"noEmit": true,
Copy link
Member

Choose a reason for hiding this comment

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

We want to use TypeScript as our compiler, not just for type checking.

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be es2015 or higher, otherwise, tree-shaking won't work.

"noEmit": true,
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
Copy link
Member

Choose a reason for hiding this comment

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

We want to publish modern code so the user can decide if they need to transpile the code. Next.js and CRA now transpile node modules, and Next.js even provides modern bundles for newer browsers.

@connor-baer
Copy link
Member

Closing in favor of #563.

@connor-baer connor-baer deleted the refactor/typescript branch July 7, 2020 09:33
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.

3 participants