question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blob doesn't implement BlobSource interface method getBlob in TypeScript

See original GitHub issue

Expected Behavior

GoogleAppsScript.Base.Blob should have getBlob()

Actual Behavior

It doesn’t

Steps to Reproduce the Problem

Utilities.gzip(Utilities.newBlob(‘text’))

Specifications

  • Node version (node -v): v8.9.3
  • Version (clasp -v):1.5.0
  • OS (Mac/Linux/Windows): Mac

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
grantcommented, Nov 5, 2018

Please file a pull request on DefinitelyTyped to fix this issue.

0reactions
takei-shgcommented, Nov 5, 2018

I also get the same error Argument of type 'Blob' is not assignable to parameter of type 'BlobSource'. Property 'getBlob' is missing in type 'Blob'. with below code.

// import Base = GoogleAppsScript.Base;
const fileBlob: Base.Blob = DriveApp.getFileById(fileId).getBlob();
const unzippedBlob: Base.Blob = Utilities.unzip(fileBlob)[0]; // Utilities.unzip cause type error.

I think the problem is the wrong function type of Utilities.unzip (and gzip, so on). The function type is currently unzip(blob: Base.BlobSource): Base.Blob[];, but it should be unzip(blob: Base.Blob): Base.Blob[];. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/google-apps-script/google-apps-script.utilities.d.ts#L70 (Though JS version also set the type BlobSource instead of Blob. It would be wrong. https://developers.google.com/apps-script/reference/utilities/utilities#unzipblob)

Version (clasp -v):1.6.0 Version (@types/google-apps-script): 0.0.30

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blob vs. Blob Source in Google Apps Script - Stack Overflow
I just want to get my type declarations correct so TypeScript continues to add value. From the documentation it looks like Blob implements...
Read more >
Blob - The Modern JavaScript Tutorial
create Blob from a string let blob = new Blob(["<html>… ... The Blob interface's stream() method returns a ReadableStream which upon reading ...
Read more >
Class UrlFetchApp | Apps Script - Google Developers
A script can use the URL Fetch service to issue HTTP and HTTPS requests and receive ... This method does not actually issue...
Read more >
Blob | typescript - v3.7.7
A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on...
Read more >
@azure/storage-blob - npm
This project provides a client library in JavaScript that makes it easy to consume Microsoft Azure Storage Blob service. Use the client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found