From 6b4aff1dda5bbd6f65809e426bd7f5617974d9cc Mon Sep 17 00:00:00 2001 From: Kling Attila Date: Mon, 23 Jul 2018 20:35:20 +0200 Subject: [PATCH] Updated type definitions for handlebars#registerPartials (#27388) * Updating types for #registerPartial #registerPartial is a polymorphic function now it accepts a single object making the second param optional. Excerpt from the implementation: ```js registerPartial: function(name, partial) { if (toString.call(name) === objectType) { extend(this.partials, name); } else { if (typeof partial === 'undefined') { throw new Exception(`Attempting to register a partial called "${name}" as undefined`); } this.partials[name] = partial; } }, ``` * Updated Handelbars#registerPartials Removed extra spaces * Added function overload with typed arguments Replaced polymorphic argument types for registerPartial function with overloaded function definition --- types/handlebars/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/handlebars/index.d.ts b/types/handlebars/index.d.ts index 480f91f6f0..6272dde3a0 100644 --- a/types/handlebars/index.d.ts +++ b/types/handlebars/index.d.ts @@ -40,6 +40,7 @@ declare namespace Handlebars { export function unregisterHelper(name: string): void; export function registerPartial(name: string, fn: Template): void; + export function registerPartial(spec: { [name: string]: HandlebarsTemplateDelegate }): void; export function unregisterPartial(name: string): void; // TODO: replace Function with actual signature