-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 1.8.0 / nightly (2.0.0-dev.201xxxxx)
Code
interface IFoo {
get(val: number): number;
getAll(val: string): number;
}
function foo(): IFoo {
return {
get(val: number): number {
return val + 1;
},
getAll(val: string): number {
return this.get(val)*10;
}
};
}Expected behavior:
Compiler show an error that val string isn't a number
Actual behavior:
No error.
Trick to get expected behavior:
interface IFoo {
get(val: number): number;
getAll(val: string): number;
}
function foo(): IFoo {
var a: IFoo = {
get(val: number): number {
return val + 1;
},
getAll(val: string): number {
return this.get(val)*10;
}
};
return a;
}Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug