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

Injectable any param needs to be optional #114

Closed pleerock closed 8 years ago

pleerock commented 8 years ago

Created a simple project using Typescript and have lot of errors

inject.d export declare function Inject(...injects: any[]): (t1: any, name: string, {value: t2}?: {}) => void;

what is "value" here? its wrong type/variable/whatever it is

injectable.d export declare const Injectable: (any) => any;

what is "(any)" here? variable? it should be (any: any) at least, also it should be optional, since all examples are specifying @Injectable() without any parameter

MikeRyanDev commented 8 years ago

Hi @PLEEROCK, my apologies. These issues have already been fixed in master but it has been a while since we've released a new alpha. I've gone ahead and published v0.0.1-alpha.11 which should fix the type errors you are getting.

Thanks!

pleerock commented 8 years ago

updated, but I dont see @Injectable to be working.

export declare const Injectable: (any: any) => any;

must be

export declare const Injectable: (any?: any) => any;

otherwise compiler gives error because any is required but not provided

@Injectable()
@Inject('$q')
class SomeComponent {
}
timkindberg commented 8 years ago

I fixed the additional issue. We'll need another release.

aweiher commented 8 years ago

As there was no release yet, how to use Injectable with parameters? How must "any" looks like in this case?

Thanks!

aweiher commented 8 years ago

Ok, found out that @Injectable(undefined) is totally valid