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

'resource' does not exist in type 'Params$Resource$Spreadsheets$Batchupdate'. #1966

Closed
francoisromain opened this issue Feb 21, 2020 · 6 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@francoisromain
Copy link

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

@JustinBeckwith
Copy link
Contributor

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 JustinBeckwith added the type: question Request for information or clarification. Not an issue. label Feb 21, 2020
@francoisromain
Copy link
Author

thank you

@nachocab
Copy link

nachocab commented Aug 6, 2020

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.

@nachocab
Copy link

nachocab commented Aug 6, 2020

@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?

@cuginoAle
Copy link

cuginoAle commented Dec 12, 2022

thanks @francoisromain and @JustinBeckwith,
just wanted to let you know that the official docs are still not up to date (12/12/22) and this causes confusion to people familiarising with the APIs: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update

thanks!

@albertosanmartin
Copy link

The official doc accept this type that contains "title" attribute but I still receiving the following error:

16.53 src/controllers/campaign/campaign-session.controller.ts(396,32): error TS2769: No overload matches this call.
16.53   Overload 1 of 6, '(params: Params$Resource$Spreadsheets$Create, options: StreamMethodOptions): GaxiosPromise<Readable>', gave the following error.
16.53     Type '{ properties: { title: string; }; }' has no properties in common with type 'Params$Resource$Spreadsheets$Create'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

5 participants