luckydonald

Typescript Linter problem

Jun 2nd, 2022 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export function asyncCanvasToBlob(canvas: HTMLCanvasElement) {
  2.   // https://github.com/jbccollins/async-canvas-to-blob/blob/31b3578eac940526049e1560d3aca01a9aa6d874/index.js#L2-L4
  3.   return new Promise<void>(function(resolve: BlobCallback) {
  4.     canvas.toBlob(resolve);
  5.   })
  6. }
  7.  
  8. // Line 03:
  9. // TS2345: Argument of type '(resolve: BlobCallback) => void' is not assignable to parameter of type '(resolve: (value: void | PromiseLike<void>) => void, reject: (reason?: any) => void) => void'.
  10. //   Types of parameters 'resolve' and 'resolve' are incompatible.
  11. //     Types of parameters 'value' and 'blob' are incompatible.
  12. //        Type 'Blob | null' is not assignable to type 'void | PromiseLike<void>'.
  13. //          Type 'null' is not assignable to type 'void | PromiseLike<void>'.
Add Comment
Please, Sign In to add comment