Add types for icon-gen

This commit is contained in:
Florian Keller
2018-12-08 18:36:18 +01:00
parent e95e11dcf2
commit 1bf07fa1da
4 changed files with 94 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import icongen = require('icon-gen');
icongen('./sample.svg', './icons', { report: true })
.then(results => {
results[0];
})
.catch(err => {
throw err;
});
icongen('./sample.svg', './icons')
.then(results => {
results[0];
})
.catch(err => {
throw err;
});
icongen('./sample.svg', './icons', {
favicon: {
ico: [16, 24, 32, 48, 64],
name: 'favicon-',
sizes: [32, 57, 72, 96, 120, 128, 144, 152, 195, 228],
},
report: false,
})
.then(results => {
results[0];
})
.catch(err => {
throw err;
});
icongen('./sample.svg', './icons', {
favicon: {},
report: false,
})
.then(results => {
results[0];
})
.catch(err => {
throw err;
});
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for icon-gen 2.0
// Project: https://github.com/akabekobeko/npm-icon-gen#readme
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace icongen {
interface Options {
favicon?: {
ico: number[];
name: string;
sizes: number[];
} | {};
icns?: {
name: string;
sizes: number[];
} | {};
ico?: {
name: string;
sizes: number[];
} | {};
report?: boolean;
}
}
declare function icongen(src: string, dest: string, options?: icongen.Options): Promise<string[]>;
export = icongen;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"icon-gen-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }