Closed
Description
Environment details
- OS: OSX
- Node.js version: v18.16.0
- npm version: 9.5.1
@google-cloud/spanner
version: 6.12.0
Steps to reproduce
- Use Typescript
- Attempt to use batch transactions as shown in
samples/batch.js
const query = {
sql: `
select
*
from
${POST_TABLE_NAME}
`,
};
const [transaction] = await this.database.createBatchTransaction();
const partitions = transaction.createQueryPartitions(query);
- Get
tsc
error:
domains/archive/post-service/src/post-service-spanner.repository.ts:274:11 - error TS2488: Type 'void' must have a '[Symbol.iterator]()' method that returns an iterator.
274 const [partitions] = await transaction.createQueryPartitions(query);
~~~~~~~~~~~~
domains/archive/post-service/src/post-service-spanner.repository.ts:274:44 - error TS2554: Expected 2 arguments, but got 1.
274 const [partitions] = await transaction.createQueryPartitions(query);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@google-cloud/spanner/build/src/batch-transaction.d.ts:111:39
111 createQueryPartitions(query: any, callback: any): void;
~~~~~~~~~~~~~
An argument for 'callback' was not provided.
The problem appears to be that your use of promisifyAll
doesn't cause the appropriate method types to be included in the .d.ts
file.