mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Test IDirective changes,
cascade generics from IModule's directive function
This commit is contained in:
@@ -1502,16 +1502,46 @@ interface MyScope extends ng.IScope {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
|
||||
templateElement: JQLite,
|
||||
templateAttributes: ng.IAttributes,
|
||||
transclude: ng.ITranscludeFunction
|
||||
): ng.IDirectiveLinkFn<MyScope> => {
|
||||
interface MyElement extends JQLite {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
interface MyAttributes extends ng.IAttributes {
|
||||
foo: string;
|
||||
}
|
||||
interface MyController extends ng.INgModelController {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope, MyElement, MyAttributes, MyController> = (
|
||||
templateElement: MyElement,
|
||||
templateAttributes: MyAttributes,
|
||||
transclude: ng.ITranscludeFunction,
|
||||
): ng.IDirectiveLinkFn<MyScope, MyElement, MyAttributes, MyController> => {
|
||||
return (
|
||||
scope: MyScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: ng.IAttributes
|
||||
instanceElement: MyElement,
|
||||
instanceAttributes: MyAttributes,
|
||||
controller: MyController,
|
||||
) => {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
|
||||
const directiveFactoryWithGeneric: ng.IDirectiveFactory<MyScope, MyElement, MyAttributes, MyController> = (
|
||||
templateElement: MyElement,
|
||||
templateAttributes: MyAttributes,
|
||||
transclude: ng.ITranscludeFunction,
|
||||
): ng.IDirective<MyScope, MyElement, MyAttributes, MyController> => {
|
||||
return {
|
||||
link: ($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) => {return; }
|
||||
};
|
||||
};
|
||||
|
||||
const directiveFactoryWithGeneric2: ng.IDirectiveFactory<MyScope, MyElement, MyAttributes, MyController> = (
|
||||
templateElement: MyElement,
|
||||
templateAttributes: MyAttributes,
|
||||
transclude: ng.ITranscludeFunction,
|
||||
): ng.IDirectiveLinkFn<MyScope, MyElement, MyAttributes, MyController> => {
|
||||
return ($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) => {return; };
|
||||
};
|
||||
|
||||
Vendored
+5
-4
@@ -240,8 +240,9 @@ declare namespace angular {
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): IModule;
|
||||
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
@@ -1346,8 +1347,8 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface ICompileProvider extends IServiceProvider {
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
|
||||
|
||||
Reference in New Issue
Block a user