Reputation:
The following code
import {Attribute, Component, View} from 'angular2/angular2';
@Component({
selector: 'card'
})
@View({
templateUrl: "app/design/card/card.html",
styleUrls: ["app/design/card/card.css"],
directives: []
})
export class Card {
constructor(@Attribute('no-teaser') noTeaser) {
this.active=false
}
}
gives me the error
Unable to resolve signature of parameter decorator when called as an expression. Supplied parameters do not match any signature of call target.
@Attribute('home')
when translating TypeScript to JavaScript.
I'm using Alpha 37, the latest definitions from DefinitelyTyped, and I'm using atom-typescript (which uses the latest typescript version)
Upvotes: 3
Views: 2668
Reputation: 18846
This is a problem with how Attribute annotation is defined in angular. I've faced the same error when tried to create my own annotation:
export function Attribute(name: string) {
return function(a, b) {
console.log(a);
console.log(b);
}
}
gived the same error like yours, so when I changed to this:
export function Attribute(name: string) {
return function(a, b, c) {
console.log(a);
console.log(b);
console.log(c);
}
}
the error is gone. Looks like you need to submit issue to angular project.
Upvotes: 1
Reputation: 275917
Unable to resolve signature of parameter decorator when called as an expression. Supplied parameters do not match any signature of call target.
Googling this error turn out : https://github.com/Microsoft/TypeScript/issues/3661
And in that you can see :
Decorating function formal parameters is currently not part of the ES7 proposal.
So I suspect constructor(@Attribute('no-teaser') noTeaser)
is intentionally disallowed in the latest TypeScript (give ntypescript
a go https://github.com/TypeStrong/ntypescript). Please report as an issue to Microsoft/TypeScript if that is the case.
Is it possible to tell atom-typescript which version of tsc to use?
Not easily as an older version of TSC might not be API compatible with the latest ... but there is this option: https://github.com/TypeStrong/atom-typescript/blob/master/docs/faq.md#can-i-use-a-custom-typescript-compiler
Upvotes: 1