mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Add types for mailgen (#13080)
This commit is contained in:
committed by
Masahiro Wakame
parent
20c296cac7
commit
d80069d043
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for mailgen 2.0
|
||||
// Project: https://github.com/eladnava/mailgen#readme
|
||||
// Definitions by: Kiet Thanh Vo <https://github.com/vothanhkiet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import Option = Mailgen.Option;
|
||||
import Content = Mailgen.Content;
|
||||
/**
|
||||
* Created by kiettv on 7/24/16.
|
||||
*/
|
||||
declare class Mailgen {
|
||||
constructor(opts: Option);
|
||||
|
||||
cacheThemes(): void;
|
||||
|
||||
generate(params: Content): any;
|
||||
|
||||
generatePlaintext(params: Content): any;
|
||||
|
||||
parseParams(params: any): any;
|
||||
}
|
||||
|
||||
declare namespace Mailgen {
|
||||
interface Option {
|
||||
theme: string;
|
||||
product: Product;
|
||||
}
|
||||
|
||||
interface Product {
|
||||
name: string;
|
||||
link: string;
|
||||
logo?: string;
|
||||
}
|
||||
|
||||
interface Content {
|
||||
body: ContentBody;
|
||||
}
|
||||
|
||||
interface ContentBody {
|
||||
name: string;
|
||||
intro: string;
|
||||
action?: Action;
|
||||
outro: string;
|
||||
}
|
||||
|
||||
interface Action {
|
||||
instructions: string;
|
||||
button: Button;
|
||||
}
|
||||
|
||||
interface Button {
|
||||
color: string;
|
||||
text: string;
|
||||
link: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = Mailgen;
|
||||
@@ -0,0 +1,20 @@
|
||||
import * as Mailgen from "mailgen"
|
||||
|
||||
const generator: Mailgen = new Mailgen({
|
||||
theme: "default",
|
||||
product: {
|
||||
name: "test",
|
||||
link: "http://localhost",
|
||||
}
|
||||
});
|
||||
|
||||
let content: Mailgen.Content = {
|
||||
body: {
|
||||
name: "Hi",
|
||||
intro: "test",
|
||||
outro: "test",
|
||||
},
|
||||
};
|
||||
|
||||
let html = generator.generate(content);
|
||||
html = generator.generatePlaintext(content);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mailgen-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Reference in New Issue
Block a user