Closed
Description
Interface is a useful tool in TypeScript, but sometimes we'll need to write two pieces of almost identical code for intellisense and functionality respectively.
Is it acceptable to add a simple statement for generating part of interface information (properties)?
E.g.
class SomeClass { }
interface ISubFace {
abc: string;
def: number;
}
interface IFace {
str: string;
num: number;
obj: SomeClass;
sub: ISubFace;
}
var faceInfo = reflect IFace;
Would emit:
var SomeClass = (function () {
function SomeClass() {
}
return SomeClass;
})();
var _ISubFaceReflection = {
abc: 'string',
def: 'number'
};
var _IFaceReflection = {
str: 'string',
num: 'number',
obj: SomeClass,
sub: _ISubFaceReflection
};
var faceInfo = _IFaceReflection;