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


#1

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


#2

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


#3

#1596 is already open.


#4

Ah, thanks!
I should have checked the github issues before posting here…