TypeScript type mismatch for `ajax` and `options.ajax` props
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Hello, and thank you for developing this React component for DataTables.
I found that both the ajax prop and options.ajax prop work fine in practice, but they produce a TypeScript type error. The current type definition doesn’t seem to match what is described in the DataTables documentation:
Error message:
Object literal may only specify known properties, and 'url' does not exist in type 'AjaxSettings | FunctionAjax'.
You can reproduce the issue here:
https://stackblitz.com/edit/datatables-net-react-ajax-xmq14ri7?file=src%2FApp.tsx
In the example, the table renders correctly and data is loaded as expected, but TypeScript still reports a type error for the ajax option. As a short-term workaround, I’m currently adding @ts-expect-error above the line to suppress the error.
Could the type definition be updated to match the documented and working behavior?
Thanks again for building and maintaining this component.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the documented usage in Readme.md at the linked section and reproduce the type error in the provided StackBlitz example. Trace the TypeScript definitions for the ajax and options.ajax props, then verify that the documented url form is accepted without an error while the table still loads data as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100