mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-07 23:37:35 +08:00
Add typing for object syntax on component registerer (#25507)
This commit is contained in:
@@ -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 {
|
||||
|
||||
7
types/angular/index.d.ts
vendored
7
types/angular/index.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user