mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
(new definition) add mjml (mjml.io) types (#25217)
* add mjml (mjml.io) types * update mjml definition, actually verify linter runs, be more explicit in re: error types * mjml: int -> number. why does lint pass w/ 'int'? ah well. * per @plantain-00 CR
This commit is contained in:
committed by
Wesley Wigham
parent
8231b1a62a
commit
fd5742930d
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for mjml 4.0
|
||||
// Project: https://github.com/mjmlio/mjml
|
||||
// Definitions by: aahoughton <https://github.com/aahoughton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface MJMLParsingOpts {
|
||||
fonts?: { [key: string]: string; };
|
||||
keepComments?: boolean;
|
||||
beautify?: boolean;
|
||||
minify?: boolean;
|
||||
validationLevel?: 'strict' | 'soft' | 'skip';
|
||||
filePath?: boolean;
|
||||
}
|
||||
|
||||
interface MJMLParseError {
|
||||
line: number;
|
||||
message: string;
|
||||
tagName: string;
|
||||
formattedMessage: string;
|
||||
}
|
||||
|
||||
interface MJMLParseResults {
|
||||
html: string;
|
||||
errors: MJMLParseError[];
|
||||
}
|
||||
|
||||
declare function mjml2html(inp: string, opts?: MJMLParsingOpts): MJMLParseResults;
|
||||
|
||||
export = mjml2html;
|
||||
@@ -0,0 +1,10 @@
|
||||
import mjml2html = require('mjml');
|
||||
|
||||
const simple_test = mjml2html("<mjml>");
|
||||
const html = simple_test.html;
|
||||
const errors = simple_test.errors;
|
||||
let formattedMessage = errors[0].formattedMessage;
|
||||
formattedMessage = "force string test";
|
||||
|
||||
const minimal_opts_test = mjml2html("<mjml>", {beautify: true});
|
||||
const validation_level_test = mjml2html("<mjml>", {validationLevel: "strict"});
|
||||
@@ -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",
|
||||
"mjml-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user