Helpers for types
See original GitHub issuevar tpl = Handlebars.Compile("{{x}}");
var o = new { x = new List<int>() {1,2,3}};
Console.WriteLine(tpl(o));
returns ToString() of my list (System.Collections.Generic.List`1[System.Int32]). How it would be possible to assign default renderer/helper for types?
Issue Analytics
- State:
- Created 7 years ago
- Comments:22 (12 by maintainers)
Top Results From Across the Web
Type Helpers
A type helper is a type that can accept other types as arguments. ... We pass in the types string and string as...
Read more >Documentation - Utility Types
Constructs a type with all properties of Type set to optional. This utility will return a type that represents all subsets of a...
Read more >Introducing Type Helpers
Type Helpers allow us to create functions that can return other types. They are the basis for many of TypeScript's core features.
Read more >Type Helpers for basic types
The sysutils unit contains type helpers for basic language types: boolean, ordinals (shortint, smallint, byte, word, integer, cardinal, int64, wqord, ...
Read more >Type helpers
XState makes several type helpers available to you for composing types in TypeScript. You can use these helpers for creating custom functions or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My key points are:
System.Collections.Generic.List1[System.Int32]
gibberish in rendered template looks not rightvalue.ToString()
(and internalEncodedTextWriter
) limits extensibility[1,2,"x","y"]
from collection but Handlebars.Net rendersSystem.Collections.Generic.List1[System.Object]
IEncodedTextWriter
orFunc<object,string>
inHandlebarsConfiguration
should not add any complexity or performance penalty.IMHO library should be as extensible, as possible and I shouldn’t need to fork for such a simple thing. Forget about type helpers, but please think about interchangeable EncodedTextWriter. I will make pull request if you are willing to accept it 😃
Hi, @JvanderStad. I know how to create helpers, that not what I need. I need to be able to override strigification, which is now hardoced in file
EncodedTextWriter.cs
. Reasons for this might be many, but mine is that I have no ability to change existing and future templates.