I am a little stumped about how I should be importing types that aren't exported directly from index.d.ts.
For example, updating to @google-cloud/bigquery 4.0 broke this code in my project:
custom type file
import { Job } from '@google-cloud/bigquery';
interface IBigQueryJobs {
[tableName: string]: Job;
}
export interface ITablesToBigQueryJobState {
bigQueryJobs: IBigQueryJobs;
}
Script file
const jobState: ITablesToBigQueryJobState = {
bigQueryJobs: {},
};
// ...
const [result] = await bqTable.load(filePath, loadJobMetaData);
// ...
jobState.bigQueryJobs[tableName] = result;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
type error:
Type 'IJob' is missing the following properties from type 'Job': bigQuery, getQueryResultsStream, cancel, getQueryResults, and 33 more.
I looked for the IJob type, or an equivalent, from the main declaration file, and could not find one. So finally I just imported directly from '@google-cloud/bigquery/build/src/types' which seemed wrong, though it did fix the type error:
custom type file
import bigquery from '@google-cloud/bigquery/build/src/types';
interface IBigQueryJobs {
[tableName: string]: bigquery.IJob;
}
export interface ITablesToBigQueryJobState {
// ...
bigQueryJobs: IBigQueryJobs;
}
Is there another way I should be thinking about this? Thank you!
Environment details
- OS:
10.14.3
- Node.js version:
v8.12.0
- npm version:
6.5.0
@google-cloud/bigquery version: "4.0.0"
I am a little stumped about how I should be importing types that aren't exported directly from
index.d.ts.For example, updating to
@google-cloud/bigquery 4.0broke this code in my project:custom type file
Script file
type error:
I looked for the
IJobtype, or an equivalent, from the main declaration file, and could not find one. So finally I just imported directly from'@google-cloud/bigquery/build/src/types'which seemed wrong, though it did fix the type error:custom type file
Is there another way I should be thinking about this? Thank you!
Environment details
10.14.3v8.12.06.5.0@google-cloud/bigqueryversion:"4.0.0"