ngUpgraders / ng-forward

The default solution for those that want to write Angular 2.x style code in Angular 1.x
411 stars 36 forks source link

Resolve and Inject value parameter needs to be optional for static class methods #155

Open linnenschmidt opened 8 years ago

linnenschmidt commented 8 years ago

In Typescript for static class methods, there is an error with the value property of the defineProperty descriptor.

@Component({
  selector: 'my-component',
  template: 'template'
})
@Inject('resolveSomething', MyService)
export class MyComponent {

  @Resolve()
  @Inject(MyService)
  static resolveSomething(MyService: MyService) {
    return MyService.getSomething();
  }
}

Argument of type 'TypedPropertyDescriptor<(MyService: MyService) => any>' is not assignable to parameter of type '{ value: any; }'. Property 'value' is optional in type 'TypedPropertyDescriptor<(MyService: MyService) => any>' but required in type '{ value: any; }'.

Here ist the optional value of the TypedPropertyDescriptor: https://github.com/Microsoft/TypeScript/blob/727b9/src/lib/core.d.ts#L1245