Google-api-nodejs-client: 'resource' does not exist in type 'Params$Resource$Spreadsheets$Batchupdate'.

Created on 21 Feb 2020  路  4Comments  路  Source: googleapis/google-api-nodejs-client

Environment details

  • OS: Mac Os 10.13.6
  • Node.js version: v13.8.0
  • npm version: 6.13.7
  • googleapis version: 47.0.0

Steps to reproduce

I try to convert this code (from the official docs: https://developers.google.com/sheets/api/guides/batchupdate) to typescript:

gapi.client.sheets.spreadsheets.batchUpdate({
  spreadsheetId: spreadsheetId,
  resource: batchUpdateRequest
})

It makes the following error:

Argument of type '{ spreadsheetId: string; resource: { requests: any; }; }' is not assignable to parameter of type 'Params$Resource$Spreadsheets$Batchupdate'.

Object literal may only specify known properties, and 'resource' does not exist in type 'Params$Resource$Spreadsheets$Batchupdate'.

(Actually here is the file I am trying to convert to ts, where I have this error: https://github.com/MTES-MCT/camino-api/blob/89a8a764177c5efda57a7154b6ffd936f63afee9/src/tools/api-google-spreadsheets/index.js#L22)

what should I do to avoid the error?

Thank you

question

All 4 comments

Greetings! It looks like this may be coming from an old tutorial. Instead of resource, can you try requestBody?
https://github.com/googleapis/google-api-nodejs-client#specifying-request-body

Let us know if this helps!

thank you

Greetings! It looks like this may be coming from an old tutorial. Instead of resource, can you try requestBody?
https://github.com/googleapis/google-api-nodejs-client#specifying-request-body

Let us know if this helps!

@JustinBeckwith I can still see resource being used in the official documentation. Is it just a synonym for requestBody? And, just curious, how does this work? I don't see the synonym specified anywhere.

@JustinBeckwith Also, same thing for uploadType (official sample) when creating a new file. Is this parameter no longer required? You provided this sample. Is providing requestBody enough for multipart? If I want a simple upload, do I need to specify uploadType?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raapperez picture raapperez  路  3Comments

suparnavg picture suparnavg  路  3Comments

leecheve picture leecheve  路  3Comments

JustinBeckwith picture JustinBeckwith  路  3Comments

ashishbajaj99 picture ashishbajaj99  路  3Comments