Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript DataTables with filters don't import or compile correctly. #2467

Closed
sergarrick opened this issue Nov 24, 2021 · 4 comments · Fixed by #2488
Closed

Typescript DataTables with filters don't import or compile correctly. #2467

sergarrick opened this issue Nov 24, 2021 · 4 comments · Fixed by #2488
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@sergarrick
Copy link

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)

https://codesandbox.io/s/ykcro
This is the same codesandbox linked from the TS documentation on DataTable's filter page.

Current behavior
FilterMatchMode imports as an interface, not an object. The objects/types used on the DataTable component down the file are also incorrect. This causes compilation to break unless errors are ignored.

Expected behavior
FilterMatchMode should import the actual object instead of the interface. DataTables should be using the correct interfaces when passing props. Compilation should work without ignoring all errors.

Minimal reproduction of the problem with instructions
Import FilterMatchMode and try to use it by calling FilterMatchMode.CONTAINS.

Please tell us about your environment:
Azure VM, VSCode Community 2019, Nextjs 12.0.1, typescript 4.4.4, eslint 7.32.0

  • React version:
    17.0.2

  • PrimeReact version:
    Tried in both 7.0.0-rc2 and 7.0.1.

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Chrome

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    Typescript 4.4.4

@melloware
Copy link
Member

Can you submit a PR? I am looking and I don't quite see what you mean?

@melloware
Copy link
Member

I see what you mean. Realistically this should be a TypeScript enum and not an interface.

@sergarrick
Copy link
Author

sergarrick commented Nov 26, 2021

I don't think there's anything special going on with my version of chrome, but if you open the codesandbox, the linter comes up with "'FilterMatchMode' only refers to a type, but is being used as a value here." as well as DataTable coming back with "No overload matches this call". This doesn't break a dev build, but it requires setting "ignore errors" when building for production. But yes, this should be an enum.

@melloware
Copy link
Member

OK PR submitted converting them to enums

@mertsincan mertsincan added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Dec 13, 2021
@mertsincan mertsincan modified the milestones: 8.0.0, 7.1.0 Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants