@ionic-native/sqlite: sqlBatch definition has wrong parameter type!

Hi there,

i just upgraded an ionic 2 project to ionic 3 (cli and native) and have a serious problem building my project because of a wrong parameter declaration in @ionic-native/sqlite/index.d.ts (line 69):

    /**
     * @param sqlStatements {Array<string | string[]>}
     * @returns {Promise<any>}
     */
    sqlBatch(sqlStatements: Array<string | string[]>): Promise<any>;

That is not correct!
The plugin doc example looks like

db.sqlBatch([
  'DROP TABLE IF EXISTS MyTable',
  'CREATE TABLE MyTable (SampleColumn)',
  [ 'INSERT INTO MyTable VALUES (?)', ['test-value'] ],
], function() {
  db.executeSql('SELECT * FROM MyTable', [], function (resultSet) {
    console.log('Sample column value: ' + resultSet.rows.item(0).SampleColumn);
  });
}, function(error) {
  console.log('Populate table error: ' + error.message);
});

Therefore the correct type definition should be:

sqlBatch(sqlStatements: Array<string | Array<string | Array<any>>>): Promise<any>;

Please fix that as soon as possibleā€¦

Thanksā€¦

p.s.: using @ionic-native/sqlite 3.10.3

Here is a better place to report this: https://github.com/driftyco/ionic-native/issues

#1596 is already open.

1 Like

Ah, thanks!
I should have checked the github issues before posting hereā€¦