type Person = {
age: number
lastName: string
}
const columnHelper = createColumnHelper<Person>()
const columns = [
columnHelper.accessor('age', {
cell: (info: CellContext<Person, number>) => info.getValue()
}),
columnHelper.accessor('lastName', {
cell: (info: CellContext<Person, String>) => info.getValue()
}),
]
By using my editor I discovered that the type specifiers of
CellContext<Person, number>
and
CellContext<Person, String>
are correct, but if I didn't have my code editor, how could I have known this? How could I have known that the function assigned to cell would need to accept a param of CellContext, how was I supposed to know the TData was Person and how would I know that TValue was number or string? Yes, the number refers to age and String refers to lastName and I can see that. But I only understand this after being told the answer from my editor.
What documentation could I have looked at to discover this without my editor's help?
I'm new to Typescript, what aspects of typescript could I have used to discover the types/signatures of the cell functions on my own?