lodash: signatures of the method _.template changed

This commit is contained in:
Ilya Mochalov
2015-10-25 00:27:19 +05:00
parent 3191f6e008
commit 3f5582eaa0
2 changed files with 50 additions and 20 deletions
+32 -18
View File
@@ -3611,24 +3611,38 @@ result = <boolean>_('abc').startsWith('a');
result = <boolean>_('abc').startsWith('a', 1);
// _.template
interface TestTemplateOptions {
escape?: RegExp;
evaluate?: RegExp;
imports?: _.Dictionary<any>;
interpolate?: RegExp;
variable?: string;
}
interface TestTemplateExecutor {
(obj?: Object): string;
source: string;
}
{
let testTemplateOptions: TestTemplateOptions
let result: TestTemplateExecutor;
result = _.template('');
result = _.template('', testTemplateOptions);
result = _('').template();
result = _('').template(testTemplateOptions);
module TestTemplate {
interface TemplateExecutor {
(obj?: Object): string;
source: string;
}
let options: {
escape?: RegExp;
evaluate?: RegExp;
imports?: _.Dictionary<any>;
interpolate?: RegExp;
sourceURL?: string;
variable?: string;
};
{
let result: TemplateExecutor;
result = _.template('');
result = _.template('', options);
result = _('').template();
result = _('').template(options);
}
{
let result: _.LoDashExplicitObjectWrapper<TemplateExecutor>;
result = _('').chain().template();
result = _('').chain().template(options);
}
}
// _.trim
+18 -2
View File
@@ -9231,6 +9231,13 @@ declare module _ {
}
//_.template
interface TemplateOptions extends TemplateSettings {
/**
* The sourceURL of the template's compiled source.
*/
sourceURL?: string;
}
interface TemplateExecutor {
(data?: Object): string;
source: string;
@@ -9259,19 +9266,28 @@ declare module _ {
* @param options.evaluate The "evaluate" delimiter.
* @param options.imports An object to import into the template as free variables.
* @param options.interpolate The "interpolate" delimiter.
* @param options.sourceURL The sourceURL of the template's compiled source.
* @param options.variable The data object variable name.
* @return Returns the compiled template function.
*/
template(
string: string,
options?: TemplateSettings): TemplateExecutor;
options?: TemplateOptions
): TemplateExecutor;
}
interface LoDashImplicitWrapper<T> {
/**
* @see _.template
*/
template(options?: TemplateSettings): TemplateExecutor;
template(options?: TemplateOptions): TemplateExecutor;
}
interface LoDashExplicitWrapper<T> {
/**
* @see _.template
*/
template(options?: TemplateOptions): LoDashExplicitObjectWrapper<TemplateExecutor>;
}
//_.trim