-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
TypeScript Version: 2.4.2
Have tryed in http://www.typescriptlang.org/play the error is the same
Code
class Action {
type: string;
payload: number;
}
type ActionCreator = ((page:number)=>Action) | Action
class Filter {
actionCreator: ActionCreator;
subStore: string;
}
const x: ActionCreator = (page: number) => {
return {
type: "foo",
payload: 1
}
}
const y: Filter = {
actionCreator: (page: number) => { return {
type: "foo",
payload: 1
} },
subStore:"foo"
}
y.actionCreator(5);
x(5);
For y.actionCreator(5)
I get
Cannot invoke an expression whose type lacks a call signature. Type 'ActionCreator' has no compatible call signatures.
Expected behavior: / Actual behavior:
As you can see it works for x
, it should work the same way for the class/interface implementation.
Related Issues:
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code