diff --git a/.changeset/cool-snakes-bathe.md b/.changeset/cool-snakes-bathe.md new file mode 100644 index 00000000000..83896219e26 --- /dev/null +++ b/.changeset/cool-snakes-bathe.md @@ -0,0 +1,5 @@ +--- +"@primer/components": patch +--- + +Migrate `Text` to TypeScript diff --git a/src/Text.js b/src/Text.tsx similarity index 55% rename from src/Text.js rename to src/Text.tsx index 60e121612d8..fad64d7ca81 100644 --- a/src/Text.js +++ b/src/Text.tsx @@ -1,10 +1,10 @@ -import styled from 'styled-components' import PropTypes from 'prop-types' +import styled from 'styled-components' +import {COMMON, SystemCommonProps, SystemTypographyProps, TYPOGRAPHY} from './constants' +import sx, {SxProp} from './sx' import theme from './theme' -import {TYPOGRAPHY, COMMON} from './constants' -import sx from './sx' -const Text = styled.span` +const Text = styled.span` ${TYPOGRAPHY}; ${COMMON}; ${sx}; @@ -21,4 +21,5 @@ Text.propTypes = { theme: PropTypes.object } +export type TextProps = React.ComponentProps export default Text diff --git a/src/__tests__/Text.js b/src/__tests__/Text.tsx similarity index 100% rename from src/__tests__/Text.js rename to src/__tests__/Text.tsx diff --git a/src/__tests__/__snapshots__/Text.js.snap b/src/__tests__/__snapshots__/Text.tsx.snap similarity index 100% rename from src/__tests__/__snapshots__/Text.js.snap rename to src/__tests__/__snapshots__/Text.tsx.snap