Open
Description
The typescript type for the connect.getResultsFromQueryId
options
argument is StatementOption
, This is shared with connection.execute
so I would expect the sqlText
to be optional.
It would probably be a better idea to give getResultsFromQueryId
its own argument type.
This code yields a typescript error
connection.getResultsFromQueryId({
queryId: queryId,
complete: function (err, stmt, rows) {
if (err) {
console.error(
"Failed to execute statement due to the following error: " +
err.message
);
} else {
console.log(rows);
}
},
});
Argument of type '{ queryId: string; complete: (err: SnowflakeError | undefined, stmt: RowStatement | FileAndStageBindStatement, rows: any[] | undefined) => void; }' is not assignable to parameter of type 'StatementOption'.
Property 'sqlText' is missing in type '{ queryId: string; complete: (err: SnowflakeError | undefined, stmt: RowStatement | FileAndStageBindStatement, rows: any[] | undefined) => void; }' but required in type 'StatementOption'.ts(2345)
index.d.ts(604, 9): 'sqlText' is declared here.
This code passes the typescript validation, but I don't know if it actually works.
connection.getResultsFromQueryId({
// not optional (bug) so need to pass empty string
sqlText: "",
queryId: queryId,
complete: function (err, stmt, rows) {
if (err) {
console.error(
"Failed to execute statement due to the following error: " +
err.message
);
reject(err);
} else {
resolve(rows);
}
},
});
Activity