Skip to content

Instantly share code, notes, and snippets.

@devmattrick
Created August 3, 2018 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devmattrick/505618926c84cbedaa821e9a512a0183 to your computer and use it in GitHub Desktop.
Save devmattrick/505618926c84cbedaa821e9a512a0183 to your computer and use it in GitHub Desktop.
Basic node-canvas Typescript Bindings
/**
* These bindings are so you can use node-canvas in your Typescript project without it yelling at you. They will not
* provide proper type checking or anything like that.
*/
declare module "canvas" {
export type Canvas = any;
export type Context2d = any;
export type CanvasRenderingContext2D = any;
export type CanvasGradient = any;
export type CanvasPattern = any;
export type Image = any;
export type ImageData = any;
export type PNGStream = any;
export type PDFStream = any;
export type JPEGStream = any;
export type DOMMatrix = any;
export type DOMPoint = any;
export function registerFont(...args: any[]): any;
export function parseFont(...args: any[]): any;
export function createCanvas(...args: any[]): any;
export function createImageData(...args: any[]): any;
export function loadImage(...args: any[]): any;
export const backends: any;
export const version: any;
export const cairoVersion: any;
export const jpegVersion: any;
export const gifVersion: any;
export const freetypeVersion: any;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment