NeVeSpl / NTypewriter

File/code generator using Scriban text templates populated with C# code metadata from Roslyn API.
https://nevespl.github.io/NTypewriter/
MIT License
126 stars 24 forks source link

TypeScriptDefault for GUID #46

Closed hiivin closed 3 years ago

hiivin commented 3 years ago

I am using the KnockoutModel Template for a C# file that has a GUID Attribute. This generates the following typescript code:

public someguid: KnockoutObservable<string> = ko.observable<string>(00000000-0000-0000-0000-000000000000)

I receive two errors: TS1121: (TS) Octal literals are not allowed in strict mode. TS1085: (TS) Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '0o0'.

I would suspect that changing the return value for GUID of the ToTypeScriptDefault method from "00000000-0000-0000-0000-000000000000" to "\"00000000-0000-0000-0000-000000000000\"" solves the problem.

NeVeSpl commented 3 years ago

Indeed, thank you for noticing that.