1

In the React-Data-Grid repo, I see

export interface DataGridProps {

  columns: ColumnList;
  (...)
  rowRenderer?: React.ReactElement | React.ComponentType;
  rowGroupRenderer?: React.ComponentType;
  (...)

and

export default class ReactDataGrid extends React.Component<DataGridProps, DataGridState> { ... }

So in the definition of ReactDataGrid we see the presence of rowGroupRenderer prop.

However, this prop is not available in the package @types/react-data-grid. There is a type called GridProps there, but not DataGridProps. Also, this GridProps does not correspond to the exported GridProps in the Grid.tsx file in the React-Data-Grid repo.

How are types in @types/data-grid-types updated? How is this kept in sync with the project?

ecraig12345
  • 2,328
  • 1
  • 19
  • 26
evianpring
  • 3,316
  • 1
  • 25
  • 54

1 Answers1

0

In this specific case, you shouldn't need to use the @types package because react-data-grid itself is written in TypeScript and publishes its types as part of the npm package (you can tell from the types setting in its package.json). So you should be able to remove the @types/react-data-grid dependency and the real types will be picked up automatically from the package itself.

In general, @types packages are hosted in the DefinitelyTyped repo (@types/react-data-grid is here). Updating these type packages is a manual process, sometimes driven by the package's users if the author/maintainer doesn't care about TypeScript support. So if you find an issue and have time to contribute a fix, that's great!

(As far as why react-data-grid has an @types package even though it exports its own typings, I'm guessing "historical reasons"--maybe it was written in JS originally and converted to TS at some point.)

ecraig12345
  • 2,328
  • 1
  • 19
  • 26
  • I saw that it is written in TypeScript, but in my project using `yarn add react-data-grid --save`, I get version "^6.1.0", and when I look in my node_modules, the dist folder has `react-data-grid.js` and `react-data-grid.min.js`, that's it. – evianpring Jul 10 '19 at 20:09
  • I did in fact make a PR for the issue in my question. But I now wonder why the package isn't distributed with type definition files. – evianpring Jul 10 '19 at 20:10
  • Oh interesting, in that case maybe the project author has their build or publishing configuration set up incorrectly? I'd recommend filing a GitHub issue in react-data-grid about the missing file. (I'm not familiar enough with the build/publishing configuration they're using to find what might be wrong.) – ecraig12345 Jul 11 '19 at 02:16