Remove unnecessary type cast

This commit is contained in:
Frederic Junod
2019-02-13 11:35:46 +01:00
parent b71d7773d3
commit c0a860a31f
5 changed files with 7 additions and 10 deletions

View File

@@ -10,14 +10,14 @@
* @return {CanvasRenderingContext2D} The context.
*/
export function createCanvasContext2D(opt_width, opt_height) {
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
const canvas = document.createElement('canvas');
if (opt_width) {
canvas.width = opt_width;
}
if (opt_height) {
canvas.height = opt_height;
}
return /** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d'));
return canvas.getContext('2d');
}