0

We're currently working on a table powered by React Virtualized and using TypeScript.

At the moment we're looking at making a custom row render.

We started off by looking at the implementation of the defaultRowRenderer.

We took that code and started modifying it to our needs, and we noticed that there are two props it expects that aren't defined in the @types/react-virtualised type definitions.

key, and onRowRightClick.

So we dug a bit deeper and had a look at the types.js which is in the same directory as defaultRowRenderer.js and found that babelPluginFlowReactPropTypes_proptype_RowRendererParams also doesn't define those props.

We then had a look at the Grid and List folders, and their types.js files do contain the key prop in babelPluginFlowReactPropTypes_proptype_RowRendererParams (List) and babelPluginFlowReactPropTypes_proptype_CellRendererParams (Grid).

Should key, and onRowRightClick be defined in Table/types.js. And if so is the fact they are missing the reason that they're also missing in the TypeScript definitions?

Or am I miss-reading the entire lot? ;)

1 Answers1

1

And if so is the fact they are missing the reason that they're also missing in the TypeScript definitions?

The TypeScript definitions aren't maintained by me so they may lag behind the actual project for no good reason.

As for why those props are missing from the Flow type in the git repo- probably just an oversight. The type isn't a strict object type so additional properties aren't treated as an error. We should add them into the type and fix it though.

bvaughn
  • 13,300
  • 45
  • 46
  • I think the TS definition maintainer uses the types.js files to identify what needs implementing in the definitions. The `key` prop was added [September last year](https://github.com/bvaughn/react-virtualized/commit/0d948540dbcea7fbcd8b2c6bab76453dc5a8b300#diff-5e3b0444be3b21a58da6e1fa5b47ba0e) and the TS definitions were last updated a month ago. I'll see if I can track the maintainer down to let them know it's missing. Thanks for the quick response! –  Oct 13 '17 at 08:36