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

Typescript conversion #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

omniverse
Copy link

Added config to build and test Typescript.

Converted src to TS (but not the tests yet).

src/WithThreshold.tsx Outdated Show resolved Hide resolved
src/WithThreshold.tsx Outdated Show resolved Hide resolved
src/WithThreshold.tsx Show resolved Hide resolved
}

export interface ResponsivePropsConfig {
propKeys: Array<string>;

Choose a reason for hiding this comment

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

Array<T> is used a couple times in this PR, but it's generally better to use T[].

@@ -17,11 +23,11 @@ ResponsiveProvider.propTypes = {
/** The names and values of the responsive breakpoints */
thresholdMap: PropTypes.object,
/** @ignore */
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,

Choose a reason for hiding this comment

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

Shouldn't propTypes be replaced with interfaces?

Copy link
Author

Choose a reason for hiding this comment

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

Technically they are not identical and still have value in non-TS apps. I was trying to change as little functionality as possible in this PR.

src/getThreshold.ts Outdated Show resolved Hide resolved
"esModuleInterop": true,
"preserveSymlinks": true,
"baseUrl": ".",
"outDir": "./dist"

Choose a reason for hiding this comment

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

Does this build to both common-js and es-modules?

Copy link
Author

Choose a reason for hiding this comment

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

only cjs

omniverse and others added 4 commits June 16, 2020 11:07
Co-authored-by: Jordan Janzen <[email protected]>
Co-authored-by: Jordan Janzen <[email protected]>
Co-authored-by: Jordan Janzen <[email protected]>
Co-authored-by: Jordan Janzen <[email protected]>
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