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 definition has set all icons to mandatory rather than optional #6023

Closed
JJ-M opened this issue Jan 10, 2022 · 4 comments
Closed
Labels
Bug Issues which are marked as Bug has PR Issues that has been fixed with a PR.

Comments

@JJ-M
Copy link

JJ-M commented Jan 10, 2022

Bootstraptable version(s) affected

1.19.1

Description

The TypeScript definition (index.d.ts) has set all icons to mandatory rather than optional, so if you try to add one icon, the TypeScript compiler insists on a reference for all of them. Was this intentional?

Also, in the BootstrapTableLocale interface formatRecordsPerPage is set as mandatory but should also probably be optional.

Example(s)

From index.d.ts:

interface BootstrapTableIcons{
toggleOff: string;
clearSearch: string;
detailOpen: string;
search: string;
fullscreen: string;
columns: string;
detailClose: string;
refresh: string;
paginationSwitchDown: string;
paginationSwitchUp: string;
toggleOn: string
}

Possible Solutions

interface BootstrapTableIcons{
toggleOff?: string;
clearSearch?: string;
detailOpen?: string;
search?: string;
fullscreen?: string;
columns?: string;
detailClose?: string;
refresh?: string;
paginationSwitchDown?: string;
paginationSwitchUp?: string;
toggleOn?: string
}

Additional Context

No response

@JJ-M JJ-M added the Bug Issues which are marked as Bug label Jan 10, 2022
@JJ-M
Copy link
Author

JJ-M commented Jan 10, 2022

I should have added, in the way TypeScript definitions work it is not possible to override the definition that is provided!

@JJ-M
Copy link
Author

JJ-M commented Jan 10, 2022

Just hit the same issue with BootstrapTableEvents - all 24 are mandatory, so if you want to add a table column event you have to add all of them so that the TypeScript will compile. I think they should all be optional.

@wenzhixin
Copy link
Owner

@JJ-M PR is welcome.

@wenzhixin
Copy link
Owner

Fixed in #6123

@wenzhixin wenzhixin added the has PR Issues that has been fixed with a PR. label May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issues which are marked as Bug has PR Issues that has been fixed with a PR.
Projects
None yet
Development

No branches or pull requests

2 participants