Adding types for angular-file-saver.

This commit is contained in:
Donald Nairn
2016-11-20 23:48:39 +00:00
parent dff6949f85
commit 49e5087c32
3 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
class ExampleCtrl {
constructor(FileSaver: angular.FileSaver) {
var data = new Blob(["Hey ho lets go!"], { type: "text/plain;charset=utf-8" });
FileSaver.saveAs(data, "text.txt");
}
}
angular
.module("fileSaverExample", ["ngFileSaver"])
.controller("ExampleCtrl", ExampleCtrl);

10
angular-file-saver/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for angular-file-saver 1.2.0
// Project: https://github.com/alferov/angular-file-saver
// Definitions by: Donald Nairn <https://github.com/deenairn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular {
interface FileSaver {
saveAs(blob: Blob, fileName: string, disableBOM: boolean);
}
}

View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"angular-file-saver-tests.ts"
]
}