-
Notifications
You must be signed in to change notification settings - Fork 235
Description
Is your feature request related to a problem? Please describe.
I have an interface with a default interface method which is a property with a getter body defined in the interface definition.
I construct a concrete class derived from the interface and I pass it to the handlebars template as the context parameter (data parameter is null). The type of the context parameter is System.Object.
Handlebars doesn't seem to evaluate the default interface method, but it does for properties defined in the derived class.
Describe the solution you'd like
Can a new option be added to the handlebars environment configuration, so that default interface methods are included?
Describe alternatives you've considered
I don't want to write an explicit implementation of each property in each derived class because it wouldn't be DRY.
Is your feature request supported by Handlebarsjs? Please provide details.
N/A
Additional context
Template:
{{DateTimeStr}}
{{OtherStr}}C#:
public interface IBaseData
{
DateTime DateTimeUtc { get; }
}
public interface IData : IBaseData
{
string DateTimeStr => DateTimeUtc.ToLocalTime().ToString("g");
}
public class Data : IData
{
public DateTime DateTimeUtc { get; set; }
public string OtherStr => DateTimeUtc.ToLocalTime().ToString("g");
}
string output = template(new Data { DateTimeUtc = DateTime.UtcNow })