What practical differences are there between defining an interface method:
interface Foo {
bar(): void;
}
and defining a property with
If these are the only declarations, these are identical.
The only difference is that you can augment the first form in a second declaration to add new signatures:
// Somewhere
interface Foo {
bar(): void;
}
// Somewhere else
interface Foo {
bar(s: number): void;
}
// Elsewhere
let x: Foo = ...
x.bar(32); // OK