Open
Description
TypeScript Version: 2.4.2
Code
export function route(method: string, path: string): MethodDecorator {
return (target: any, name: string, descriptor: TypedPropertyDescriptor<Function>) => {
routeManager.regeisterRoute({
constructor: target.constructor,
function: descriptor.value,
method,
path
});
}
}
export function route(method: string, path: string): MethodDecorator<Function> {
return (target: any, name: string, descriptor: TypedPropertyDescriptor<Function>) => {
routeManager.regeisterRoute({
constructor: target.constructor,
function: descriptor.value,
method,
path
});
}
}
Expected behavior:
No error
Actual behavior:
error TS2322: Type '(target: any, name: string, descriptor: TypedPropertyDescriptor<Function>) => void' is not assignable to type 'MethodDecorate
or'.
Types of parameters 'descriptor' and 'descriptor' are incompatible.
Type 'TypedPropertyDescriptor<T>' is not assignable to type 'TypedPropertyDescriptor<Function>'.
Type 'T' is not assignable to type 'Function'.
error TS2315: Type 'MethodDecorator' is not generic.