Add typing for object syntax on component registerer (#25507)

This commit is contained in:
Oscar Busk
2018-05-03 19:51:31 +02:00
committed by Andy
parent 6372e41de5
commit f4e0c531ba
2 changed files with 19 additions and 1 deletions

View File

@@ -1138,7 +1138,8 @@ angular.module('multiSlotTranscludeExample', [])
};
});
angular.module('componentExample', [])
// $ExpectType IModule
const componentModule = angular.module('componentExample', [])
.component('counter', {
require: {ctrl: '^ctrl'},
bindings: {
@@ -1160,6 +1161,16 @@ angular.module('componentExample', [])
},
template: '',
transclude: true
})
.component({
aThirdComponent: {
controller: class AThirdComponentController {
count: number;
},
bindings: {
count: '='
}
}
});
interface ICopyExampleUser {

View File

@@ -196,6 +196,12 @@ declare namespace angular {
* @param options A definition object passed into the component.
*/
component(name: string, options: IComponentOptions): IModule;
/**
* Use this method to register a component.
*
* @param object Object map of components where the keys are the names and the values are the component definition objects
*/
component(object: {[componentName: string]: IComponentOptions}): IModule;
/**
* Use this method to register work which needs to be performed on module loading.
*
@@ -1273,6 +1279,7 @@ declare namespace angular {
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
component(name: string, options: IComponentOptions): ICompileProvider;
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
aHrefSanitizationWhitelist(): RegExp;
aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;