Typewriter doesn't seem to pull out inherited properties
public class BaseClass
{
public int Id { get; set; }
}
public class MyClass : BaseClass
{
public string Name { get; set; }
}
.tst file
namespace ModelNs {
$Classes()[
export class $Name { $Properties()[
public $name: $Type;]
public constructor() { }
}]
}
Output
namespace ModelNs {
export class MyClass {
public method: string;
public constructor() { }
}
}
It's missing the Id property.
Yes, I could add the line
public id: number;
to .tst file as a stop gap, but have more properties to add (than this example).
You can use $BaseClass
to access properties from inherited classes e.g.
namespace ModelNs {
$Classes()[
export class $Name {
// Inherited properties
$BaseClass[$Properties[
public $name: $Type;]]
$Properties[
public $name: $Type;]
public constructor() { }
}]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With