From 443d1cdc3268bd786bc0b3510b0c0953eb832215 Mon Sep 17 00:00:00 2001 From: Quentin Bouygues Date: Mon, 17 Dec 2018 10:00:24 +0100 Subject: [PATCH] Add tests for directive generics --- types/angular/angular-tests.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 6d3886edc6..b3a8f2fd67 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -1545,3 +1545,23 @@ const directiveFactoryWithGeneric2: ng.IDirectiveFactory => { return ($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) => {return; }; }; + +angular.module('WithGenerics', []).directive('usingDirectiveFactoryWithGeneric', directiveFactoryWithGeneric).directive('usingDirectiveFactoryWithGeneric2', directiveFactoryWithGeneric2); + +class DirectiveWithGenerics implements ng.IDirective { + restrict = 'EAC'; + + compile(templateElement: MyElement) { + return { + pre: this.link + }; + } + + static instance(): ng.IDirective { + return new DirectiveWithGenerics(); + } + + link($scope: MyScope, templateElement: MyElement, templateAttributes: MyAttributes, controller: MyController) {} +} + +angular.module('WithGenerics', []).directive('directiveWithGenerics', DirectiveWithGenerics.instance);