So, with the awesome type safety features delivered by TypeScript, I'm running into a new kind of problem. Say I want to pass strongly typed view models around. Is it better to type these with primitive properties or KO-wrapped properties? Is there some way of making a standard interface that would support both? As in
interface IPerson {
FirstName: String;
}
class Person implements IPerson {
FirstName: String;
}
class KOPerson implements IPerson {
FirstName: KnockoutObservableString;
}
Obviously, the above won't compile. Is there any way to accomplish some kind of polymorphism where either unwrapped or KO-wrapped versions of view models can be passed around through the same shared interfaces? Without reverting to "any" typing everywhere? I hate to bake Knockout-awareness into all my view model types. I hope this line of questioning makes sense!