Skip to content

Commit 5ee5847

Browse files
committed
Types: Fix integration with DataTables ext object
Types: `new Buttons` constructor returns an instance of Buttons Types: Button methods have their own trigger method
1 parent 8641fdf commit 5ee5847

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

types/types.d.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ declare module 'datatables.net' {
5252
/**
5353
* Create a new Buttons instance for the target DataTable
5454
*/
55-
new (dt: Api<any>, settings: boolean | ConfigButtons | Array<string | ButtonConfig>): void;
55+
new (dt: Api<any>, settings: boolean | ConfigButtons | Array<string | ButtonConfig>): DataTablesStatic['Buttons'];
5656

5757
/**
5858
* Buttons version
@@ -78,8 +78,10 @@ declare module 'datatables.net' {
7878
}
7979
}
8080

81-
interface DataTablesStaticExt {
82-
buttons: ExtButtons;
81+
interface DataTablesStaticExtButtons {
82+
[name: string]: ButtonConfigCommon;
83+
84+
collection: ButtonCollection;
8385
}
8486

8587

@@ -231,7 +233,7 @@ declare module 'datatables.net' {
231233
exportData(options?: ButtonsApiExportDataParameter): ButtonsApiExportDataReturn;
232234
}
233235

234-
interface ApiButtonsMethods<T> extends Api<T> {
236+
interface ApiButtonsMethods<T> extends Omit<Api<T>, 'trigger'> {
235237
/**
236238
* Get the action function for the selected button.
237239
*
@@ -490,12 +492,6 @@ declare module 'datatables.net' {
490492

491493
type FunctionExtButtonsCollectionText = (a: any) => string;
492494

493-
interface ExtButtons {
494-
[name: string]: ButtonConfigCommon;
495-
496-
collection: ButtonCollection;
497-
}
498-
499495
/**
500496
* Collection button
501497
*/

0 commit comments

Comments
 (0)