canvas 方法参数智能提示

在代码前面添加  /** @type {HTMLCanvasElement} */

 window.onload = function () {
        /** @type {HTMLCanvasElement} */
        const canvas = document.getElementById("canvas")
        canvas.width = 800
        canvas.height = 600;
        const context = canvas.getContext('2d');
        context.fillStyle = '#fff';
        context.fillRect(0, 0, 800, 600);
    }

  

原文地址:https://www.cnblogs.com/lskzj/p/13044874.html