The following code is taken from angular source code, di.ts
.
export interface AttributeDecorator {
(name: string): any;
new (name: string): Attribute;
}
I understand this is an interface. But what new (name: string): Attribute
is doing and why there is two types for name, string and any
.
The above code is followed by
export interface Attribute { attributeName?: string; }
export const Attribute: AttributeDecorator = makeParamDecorator('Attribute', (attributeName?: string) => ({attributeName}));