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

primevue/api: TypeScript compilation errors due to wrong declarations #1154

Closed
zmwangx opened this issue Apr 8, 2021 · 1 comment · Fixed by #1155
Closed

primevue/api: TypeScript compilation errors due to wrong declarations #1154

zmwangx opened this issue Apr 8, 2021 · 1 comment · Fixed by #1155
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@zmwangx
Copy link
Contributor

zmwangx commented Apr 8, 2021

Currently, a couple of type declarations in src/components/api/Api.d.ts

export const FilterMatchMode = {
STARTS_WITH?: string,
CONTAINS?: string,
NOT_CONTAINS?: string,
ENDS_WITH?: string,
EQUALS?: string,
NOT_EQUALS?: string,
IN?: string,
LESS_THAN?: string,
LESS_THAN_OR_EQUAL_TO?: string,
GREATER_THAN?: string,
GREATER_THAN_OR_EQUAL_TO?: string,
BETWEEN?: string,
DATE_IS?: string,
DATE_IS_NOT?: string,
DATE_BEFORE?: string,
DATE_AFTER?: string
}
export const FilterOperator = {
AND?: string,
OR?: string
}
are mistakenly written as assignments, leading to a host of TypeScript compilation errors when primevue/api is imported:

$ tsc src/components/api/Api.d.ts
src/components/api/Api.d.ts(1,32): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.
src/components/api/Api.d.ts(2,16): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(2,19): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(3,13): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(3,16): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(4,17): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(4,20): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(5,14): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(5,17): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(6,11): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(6,14): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(7,15): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(7,18): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(8,7): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(8,10): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(9,14): error TS1162: An object member cannot be declared optional.
src/components/api/Api.d.ts(9,17): error TS2693: 'string' only refers to a type, but is being used as a value here.
src/components/api/Api.d.ts(10,26): error TS1162: An object member cannot be declared optional.
...
zmwangx added a commit to zmwangx/primevue that referenced this issue Apr 8, 2021
@cagataycivici cagataycivici self-assigned this Apr 14, 2021
@cagataycivici cagataycivici added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Apr 14, 2021
@cagataycivici cagataycivici added this to the 3.4.0 milestone Apr 14, 2021
@cagataycivici
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants