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

Api: Type mismatch #3727

Closed
JeffreyNijs opened this issue Mar 10, 2023 · 6 comments · Fixed by #3728
Closed

Api: Type mismatch #3727

JeffreyNijs opened this issue Mar 10, 2023 · 6 comments · Fixed by #3728
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@JeffreyNijs
Copy link
Contributor

Describe the bug

Type checks fail for 3.24.0 when using a variable with an interface extending type DataTableFilterMeta and giving an object with matchMode using FilterMatchMode. FilterMatchMode is of type string but matchMode expects specific values.

This error occurs:

Type 'string' is not assignable to type '"startsWith" | "contains" | "notContains" | "endsWith" | "equals" | "notEquals" | "in" | "lt" | "lte" | "gt" | "gte" | "between" | "dateIs" | "dateIsNot" | "dateBefore" | "dateAfter" | undefined'.

This applies to other types defined in Api.d.ts.

Reproducer

https://codesandbox.io/s/eloquent-proskuriakova-wy0x47?file=/src/customerTableFilters.type.ts

PrimeVue version

3.24.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. Go to 'src/customerTableFilters.type.ts'.
  2. Notice TS error below the comment.

Expected behavior

No TS error. matchMode should expect the correct string values.

@JeffreyNijs JeffreyNijs added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 10, 2023
@mertsincan mertsincan self-assigned this Mar 10, 2023
@mertsincan mertsincan added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Mar 10, 2023
@mertsincan mertsincan added this to the 3.24.1 milestone Mar 10, 2023
@loneil
Copy link
Contributor

loneil commented Mar 11, 2023

Hmm I've just come across this as well after updating a functioning app from 3.23 to 3.24.
Is there any workaround? I'm still getting the error even if using a hard-coded string instead of the type

image

@loneil
Copy link
Contributor

loneil commented Mar 11, 2023

Looks like casting it removes the error for me actually.

image

image

@mertsincan mertsincan added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Pending Review Issue or pull request is being reviewed by Core Team Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 13, 2023
mertsincan added a commit that referenced this issue Mar 13, 2023
@Goldenaries658
Copy link

@mertsincan You've refactored the solution in 53312c0. However this seems to break it as seen below. Happy to open a new issue if needed.
image

@JeffreyNijs
Copy link
Contributor Author

@mertsincan You've refactored the solution in 53312c0. However this seems to break it as seen below. Happy to open a new issue if needed. image

Use FilterMatchModeOptions instead.

@JeffreyNijs
Copy link
Contributor Author

Actually I can confirm this is still an issue. Now that it's an enum in the .d.ts file, it can't be found in the esm.js file when building the application.

@JeffreyNijs
Copy link
Contributor Author

Please see the related issue: #3751 (comment)

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.

4 participants