mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add object type to the MJML package (#42066)
* Add object type to the MJML package * Add more a more specific interface * Add missing types to MJML and make optional ones optional * Add usage examples to the MJML test file
This commit is contained in:
parent
1b802a91a7
commit
7049fc4b4c
10
types/mjml/index.d.ts
vendored
10
types/mjml/index.d.ts
vendored
@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/mjmlio/mjml, https://mjml.io
|
||||
// Definitions by: aahoughton <https://github.com/aahoughton>
|
||||
// marpstar <https://github.com/marpstar>
|
||||
// eiskalteschatten <https://github.com/eiskalteschatten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface MJMLParsingOpts {
|
||||
@ -25,6 +26,13 @@ interface MJMLParseResults {
|
||||
errors: MJMLParseError[];
|
||||
}
|
||||
|
||||
declare function mjml2html(inp: string, opts?: MJMLParsingOpts): MJMLParseResults;
|
||||
interface MJMLJsonObject {
|
||||
tagName: string;
|
||||
attributes: object;
|
||||
children?: MJMLJsonObject[];
|
||||
content?: string;
|
||||
}
|
||||
|
||||
declare function mjml2html(inp: string | MJMLJsonObject, opts?: MJMLParsingOpts): MJMLParseResults;
|
||||
|
||||
export = mjml2html;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import mjml2html = require('mjml');
|
||||
import mjml2html = require("mjml");
|
||||
|
||||
const simple_test = mjml2html("<mjml>");
|
||||
const html = simple_test.html;
|
||||
@ -9,3 +9,6 @@ formattedMessage = "force string test";
|
||||
const minimal_opts_test = mjml2html("<mjml>", {beautify: true});
|
||||
const validation_level_test = mjml2html("<mjml>", {validationLevel: "strict"});
|
||||
const filePath_test = mjml2html("<mjml>", {filePath: "."});
|
||||
|
||||
const jsonObject = {tagName: "mjml", attributes: {width: "100px"}, content: "test content"};
|
||||
const jsonObject_test = mjml2html(jsonObject);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user