mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
lodash: signatures of the method _.template changed
This commit is contained in:
+32
-18
@@ -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
|
||||
|
||||
Vendored
+18
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user