0

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' };
            }
        }];

enter image description here

Sandbox is here, where it seems to work https://codesandbox.io/s/table-validator-7ib2n

1 Answer 1

0

This is a compiler error, you will see the same error when running tsc in command line. The error is also shown in sandbox:

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

It seems to work in the sandbox but not in IntelliJ. Maybe it's just a warning in the sandbox. But if it's a compiler error, how do I fix it? Do I need to specify the correct type?
it's a compiler error in both the sandbox and IDEA; you need changing the method signature to get rid of the error
Well, again, that's exactly what I'm asking help for. I couldn't figure out what the signature needs to be. Despite the error, the code seems to run in the Sandbox, but I can't get it to run in IntelliJ

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.