From 039151ba67fe59a03e26ea6d69c3c9a71fd2054d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20B=C5=82a=C5=BCejewicz=20=28Peter=20Blazejewicz=29?= Date: Wed, 19 Feb 2020 20:19:11 +0100 Subject: [PATCH] fix(ejs): add missing options property (#42422) * fix(ejs): add missing options property - `outputFunctionName` configuration option - test updated Thanks! * Update types/ejs/index.d.ts Resolve PR comments Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> * Update types/ejs/index.d.ts Resolve PR comments Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> * Update types/ejs/index.d.ts Resolve PR comments Co-Authored-By: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> * Update authors as per PR comment Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com> --- types/ejs/index.d.ts | 4 ++++ types/ejs/test/ejs.cjs.test.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/types/ejs/index.d.ts b/types/ejs/index.d.ts index fc921cffb5..90fcd949a5 100644 --- a/types/ejs/index.d.ts +++ b/types/ejs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://ejs.co/, https://github.com/mde/ejs // Definitions by: Ben Liddicott // ExE Boss +// Piotr Błażejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -415,6 +416,9 @@ export interface Options { * @default ejs.localsName */ localsName?: string; + + /** Set to a string (e.g., 'echo' or 'print') for a function to print output inside scriptlet tags. */ + outputFunctionName?: string; } export interface Cache { diff --git a/types/ejs/test/ejs.cjs.test.ts b/types/ejs/test/ejs.cjs.test.ts index e7ea26bdc4..6a163e12ec 100644 --- a/types/ejs/test/ejs.cjs.test.ts +++ b/types/ejs/test/ejs.cjs.test.ts @@ -24,6 +24,7 @@ const SimpleCallback = (err: any, html: string) => { result = ejs.render(template); result = ejs.render(template, data); result = ejs.render(template, data, options); +ejs.render('<% echo(\'foo\'); %>', {}, { outputFunctionName: 'echo' }); result = ejs.renderFile(fileName, SimpleCallback); result = ejs.renderFile(fileName, data, SimpleCallback);