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

Types for components #646

Merged
merged 9 commits into from
Oct 29, 2019
Merged

Types for components #646

merged 9 commits into from
Oct 29, 2019

Conversation

Pasalietis
Copy link
Contributor

@Pasalietis Pasalietis commented Oct 9, 2019

This is types for components only. So there is missing types for theme and etc

Also list of components with props = Record<string, any>

  • InlineAlert
  • AutocompleteItem
  • Badge
  • Pill
  • BackButton
  • TextDropdownButton
  • Combobox
  • StackingOrder
  • Intent
  • Position
  • CornerDialog
  • Dialog
  • FilePicker
  • IconNames
  • Image
  • Overlay
  • Portal
  • minorScale
  • majorScale
  • Select
  • SelectField
  • OptionShapePropType
  • OptionsList
  • SelectedPropType
  • SelectMenuContent
  • Switch
  • extractStyles
  • StackingContext
  • Table
  • TableHead
  • TableHeaderCell
  • TextTableHeaderCell
  • SearchTableHeaderCell
  • TableBody
  • TableRow
  • TableCell
  • TextTableCell
  • TagInput
  • ThemeContext
  • ThemeProvider
  • ThemeConsumer
  • withTheme
  • defaultTheme
  • Textarea
  • toaster
  • UnorderedList
  • Ul
  • OrderedList
  • Ol
  • ListItem
  • Li
  • Heading
  • Code
  • Pre
  • Link
  • Small
  • Strong

Todo:

@Pasalietis Pasalietis mentioned this pull request Oct 11, 2019
Copy link
Contributor

@mshwery mshwery left a comment

Choose a reason for hiding this comment

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

@Pasalietis awesome work kicking this off!

We'll want to include types via package.json – something like this:
https://github.com/segmentio/evergreen/blob/typescript/package.json#L25

I'm going to hold off on more comments because I think we can very quickly evolve this once it lands.

index.d.ts Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
index.d.ts Outdated Show resolved Hide resolved
OptionsList
SelectMenuContent
Table
TableHead
TableHeaderCell
TextTableHeaderCell
SearchTableHeaderCell
TableBody
TableRow
TableCell
TextTableCell
export class Autocomplete extends React.PureComponent<AutocompleteProps> {
}

export interface AvatarProps extends BoxProps<'div'> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks right as a starting point. I think it'll produce the wrong type for when you pass a custom is value, but for that to work we'd need to do something like React.ComponentProps<typeof Box> but I've tried that and it won't play nicely with the prop generic inference we have going on with is.

Copy link
Contributor

@mshwery mshwery left a comment

Choose a reason for hiding this comment

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

Can you make sure we include the file path for these types in the package.json?

@Pasalietis
Copy link
Contributor Author

Can you make sure we include the file path for these types in the package.json?

do you mean just add
"types": "index.d.ts" ?

@pearlyplan
Copy link

@mshwery @Pasalietis anything I can do to help this along? I've been improving my local typings and will contribute my edits as soon as this is up!

@Pasalietis
Copy link
Contributor Author

@mshwery @Pasalietis anything I can do to help this along? I've been improving my local typings and will contribute my edits as soon as this is up!

I need help with setting types in package.json

package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
@mshwery mshwery merged commit 15387b8 into segmentio:master Oct 29, 2019
@seanemmer
Copy link

Thanks so much for pushing this through everyone, makes the library much more usable!

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.

None yet

4 participants