TypeScript Version: 3.1.1
Search Terms:
createImageBitmap, ImageBitmapOptions, Image Bitmap, lib.dom
Code
const bitmap1 = createImageBitmap(img, { premultiplyAlpha: 'none' })
const bitmap2 = createImageBitmap(img, 0, 0, img.width, img.height, { premultiplyAlpha: 'none' })
Expected behavior:
Should compile and create Promise<ImageBitmap> in both cases.
Actual behavior:
Doesn't compile since last optional options param was removed from lib.dom.d.ts between 3.0.3 and 3.1.0. Although ImageBitmapOptions are still present in lib.dom.d.ts.
Playground Link:
http://www.typescriptlang.org/play/#src=new%20Promise%3CHTMLImageElement%3E((resolve)%20%3D%3E%20%7B%0D%0A%20%20%20%20const%20image%20%3D%20new%20Image()%0D%0A%20%20%20%20image.src%20%3D%20'http%3A%2F%2Fwww.typescriptlang.org%2Fassets%2Fimages%2Flogo_nocircle.svg'%0D%0A%20%20%20%20image.onload%20%3D%20()%20%3D%3E%20%7B%20resolve(image)%20%7D%0D%0A%7D).then((image)%20%3D%3E%20%7B%0D%0A%20%20%20%20return%20createImageBitmap(image%2C%200%2C%200%2C%20image.width%2C%20image.height%2C%20%7B%0D%0A%20%20%20%20%20%20%20%20premultiplyAlpha%3A%20'none'%0D%0A%20%20%20%20%7D)%0D%0A%7D)
It was removed in commit ee25cde with vendor specific types (even though it's not vendor-specific).
Even though not all browsers supports last optional param, it's still part of living standard.
TypeScript Version: 3.1.1
Search Terms:
createImageBitmap,ImageBitmapOptions,Image Bitmap,lib.domCode
Expected behavior:
Should compile and create
Promise<ImageBitmap>in both cases.Actual behavior:
Doesn't compile since last optional options param was removed from
lib.dom.d.tsbetween3.0.3and3.1.0. AlthoughImageBitmapOptionsare still present inlib.dom.d.ts.Playground Link:
http://www.typescriptlang.org/play/#src=new%20Promise%3CHTMLImageElement%3E((resolve)%20%3D%3E%20%7B%0D%0A%20%20%20%20const%20image%20%3D%20new%20Image()%0D%0A%20%20%20%20image.src%20%3D%20'http%3A%2F%2Fwww.typescriptlang.org%2Fassets%2Fimages%2Flogo_nocircle.svg'%0D%0A%20%20%20%20image.onload%20%3D%20()%20%3D%3E%20%7B%20resolve(image)%20%7D%0D%0A%7D).then((image)%20%3D%3E%20%7B%0D%0A%20%20%20%20return%20createImageBitmap(image%2C%200%2C%200%2C%20image.width%2C%20image.height%2C%20%7B%0D%0A%20%20%20%20%20%20%20%20premultiplyAlpha%3A%20'none'%0D%0A%20%20%20%20%7D)%0D%0A%7D)
It was removed in commit ee25cde with vendor specific types (even though it's not vendor-specific).
Even though not all browsers supports last optional param, it's still part of living standard.