docs(sqlite): Add interface for transaction callback function argument (#2586)

The transaction callback function argument is currently typed as `any`, however this isn't very  helpful so I have added a base interface which contains only the `executeSql` function. This function is all that is available on the object returned by WebSQL, but is also available on the full SQLite implementation.
This commit is contained in:
Matt 2018-07-08 17:43:31 +01:00 committed by Daniel Sogl
parent 3f9311090d
commit 713efd7206

View File

@ -36,14 +36,20 @@ export interface SQLiteDatabaseConfig {
/** /**
* @hidden * @hidden
*/ */
export interface SQLiteTransaction { export interface DbTransaction {
start: () => void;
executeSql: ( executeSql: (
sql: any, sql: any,
values: any, values: any,
success: Function, success: Function,
error: Function error: Function
) => void; ) => void;
}
/**
* @hidden
*/
export interface SQLiteTransaction extends DbTransaction {
start: () => void;
addStatement: ( addStatement: (
sql: any, sql: any,
values: any, values: any,
@ -74,14 +80,14 @@ export class SQLiteObject {
addTransaction(transaction: (tx: SQLiteTransaction) => void): void {} addTransaction(transaction: (tx: SQLiteTransaction) => void): void {}
/** /**
* @param fn {any} * @param fn {Function}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@CordovaInstance({ @CordovaInstance({
successIndex: 2, successIndex: 2,
errorIndex: 1 errorIndex: 1
}) })
transaction(fn: any): Promise<any> { transaction(fn: (tx: DbTransaction) => void): Promise<any> {
return; return;
} }