You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
But probably not possible because IHandlebars.Compile returns HandlebarsTemplate<object, object> and we cannot specify the generic type argument for TContext.
Activity
[-]Substitute mustache with value from a default interface method[/-][+]default interface methods[/+]eshadboltadr commentedon Mar 18, 2025
Sounds like it might be possible if the template takes an IData, but it doesn't work if it takes a Data or IBaseData or System.Object.
eshadboltadr commentedon Mar 18, 2025
But probably not possible because IHandlebars.Compile returns HandlebarsTemplate<object, object> and we cannot specify the generic type argument for TContext.
fix: resolve properties backed by default interface members (issue #601)
Merge pull request #658 from Handlebars-Net/fix/issue-601-default-int…