Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js example for updating spreadsheet values does not compile #929

Open
songyang-dev opened this issue Oct 24, 2024 · 0 comments
Open
Assignees

Comments

@songyang-dev
Copy link

Summary

Following the example on node.js, the Typescript compiler complains about incorrect types on the update method.

Expected Behavior

Sample URL: https://github.com/googleworkspace/node-samples/blob/main/sheets/snippets/sheets_update_values.js
Description: No Typescript errors

Actual Behavior

Screenshot 2024-10-24 at 7 50 18 PM
No overload matches this call.
  Overload 1 of 6, '(params?: Params$Resource$Spreadsheets$Values$Update | undefined, options?: MethodOptions | undefined): GaxiosPromise<...>', gave the following error.
    Object literal may only specify known properties, and 'resource' does not exist in type 'Params$Resource$Spreadsheets$Values$Update'.
  Overload 2 of 6, '(callback: BodyResponseCallback<Schema$UpdateValuesResponse>): void', gave the following error.
    Object literal may only specify known properties, and 'auth' does not exist in type 'BodyResponseCallback<Schema$UpdateValuesResponse>'.
  async setCells(range: string, values: string[][]) {
    return await this.sheets.spreadsheets.values.update({
      auth: this.auth,
      spreadsheetId: this.spreadsheetId,
      range: range,
      valueInputOption: "USER_ENTERED",
      resource: { values },
    });
  }

Steps to Reproduce the Problem

  1. Copy the API call for update from the docs into a project that has a JS server side, e.g. node.js or in my case, Nuxt.
  2. See the error.

Workaround

Changing resource to requestBody solves the issue. I suggest updating the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants