diff --git a/types/canvas-fit/canvas-fit-tests.ts b/types/canvas-fit/canvas-fit-tests.ts
new file mode 100644
index 0000000000..e6006dd007
--- /dev/null
+++ b/types/canvas-fit/canvas-fit-tests.ts
@@ -0,0 +1,16 @@
+///
+
+import fit = require('canvas-fit');
+
+const canvas = document.createElement('canvas');
+window.addEventListener('resize', fit(canvas), false);
+window.addEventListener('resize', fit(canvas, window), false);
+window.addEventListener('resize', fit(canvas, window, '20%'), false);
+window.addEventListener('resize', fit(canvas, window, 20.5), false);
+
+const resize = fit(canvas, window);
+resize.scale = window.devicePixelRatio;
+resize.parent = document.body;
+resize.parent = () => {
+ return [window.innerWidth - 300, window.innerHeight];
+};
diff --git a/types/canvas-fit/index.d.ts b/types/canvas-fit/index.d.ts
new file mode 100644
index 0000000000..e76b3dfd26
--- /dev/null
+++ b/types/canvas-fit/index.d.ts
@@ -0,0 +1,35 @@
+// Type definitions for canvas-fit 1.5
+// Project: https://github.com/hughsk/canvas-fit
+// Definitions by: Piotr Błażejewicz
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+/**
+ * Creates a resize function for your canvas element. Calling this function will resize the canvas to fit its parent element.
+ */
+declare function fit(
+ canvas: HTMLCanvasElement | SVGElement,
+ parent?: EventTarget | Document | HTMLElement,
+ scale?: string | number,
+): resize;
+
+interface resize {
+ (this: any, ev: any): any;
+ /**
+ * Dynamically change the canvas' target scale.
+ * Note that you still need to manually trigger a resize after doing this.
+ */
+ scale?: number;
+ /**
+ * Dynamically change the canvas' target scale.
+ * Note that you still need to manually trigger a resize after doing this.
+ * Instead of filling a given element, explicitly set the width and height of the canvas.
+ * Note that this value will still be scaled up according to resize.scale
+ */
+ parent?: Element | (() => [number, number]);
+}
+
+/**
+ * Small module for fitting a canvas element within the bounds of its parent.
+ * Useful, for example, for making a canvas fill the screen. Works with SVG elements too!
+ */
+export = fit;
diff --git a/types/canvas-fit/tsconfig.json b/types/canvas-fit/tsconfig.json
new file mode 100644
index 0000000000..06b048e8d1
--- /dev/null
+++ b/types/canvas-fit/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6",
+ "DOM"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictFunctionTypes": true,
+ "strictNullChecks": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "canvas-fit-tests.ts"
+ ]
+}
diff --git a/types/canvas-fit/tslint.json b/types/canvas-fit/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/canvas-fit/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }