Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

Can't Import Useful Types From Main Declaration File #456

@foxdoubt

Description

@foxdoubt

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"

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/nodejs-bigquery API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions