'IntelliJ reporting typescript error for react-bootstrap-table-next
I'm using react-bootstrap-table-next (aka react-bootstrap-table2). I'm getting a Typescript error in IntelliJ on the validator field in my column definition. I can't seem to get around it in IntelliJ although it works OK in the sandbox. Even putting //@ts-ignore
on it doesn't help
Here's my column definition:
const columns: ColumnDescription[] = [
{
dataField: 'id',
text: 'Product ID',
headerStyle: () => {
return { width: '20%', textAlign: 'center' };
}
},
{
dataField: 'name',
text: 'Product Name',
sort: true,
headerStyle: () => {
return { width: '60%', textAlign: 'center' };
}
},
{
dataField: 'value',
text: 'Product value',
sort: true,
validator: (newValue, row, column) => {
if (isNaN(newValue)) {
return {
valid: false,
message: 'This field needs to be a number'
};
}
},
headerStyle: () => {
return { width: '20%', textAlign: 'center' };
}
}];
Sandbox is here, where it seems to work https://codesandbox.io/s/table-validator-7ib2n
Solution 1:[1]
This is a compiler error, you will see the same error when running tsc
in command line. The error is also shown in sandbox:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | lena |