Announcement

Collapse
No announcement yet.

Generating Typescript in the future?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • selinc
    started a topic Generating Typescript in the future?

    Generating Typescript in the future?

    I am curious if this is/will be on your radar at some point in the future? I know Typescript has a great deal of momentum (but understand getting the most bang for your buck my targeting Javascript with .d.ts).

    I wonder if this would improve even future the generation. Maybe it won't since all type information of course is present in the C# code.

    The reason I ask is because I see some generated code that doesn't translate straight forwardly (not as I would expect anyway). I assume this is probably due to generalization of the cases.

    For reference here is a piece of code and its translation:
    Input:
        public static class ObservableExtensions
        {
            public static DerivedProperty<TOut> Derive<TIn,TOut>(this IProperty<TIn> prop, Func<TIn, TOut> transform)
            {
                return new DerivedProperty<TOut>(() => transform(prop.Value), prop);
            }
        }
    Output:
        Bridge.define("Observable_Bridge.ObservableExtensions", {
            statics: {
                methods: {
                    Derive: function (TIn, TOut, prop, transform) {
                        return new (Test.DerivedProperty$1(TOut))(function () {
                            return transform(prop["Test$IProperty$1$" + Bridge.getTypeAlias(TIn) + "$Value"]);
                        }, [prop]);
                    }
                }
            }
        });
    I can't figure out why the prop's Value member is being accessed via a string...

  • geoffrey.mcgill
    replied
    I've never been convinced compiling to TypeScript would bring much value.

    Leave a comment:


  • selinc
    replied
    Thanks again from the prompt response.

    I'd still be curious of your teams thoughts on Typescript and whether Bridge.NET would ever generate Typescript directly -- Or whether it would bring much value at all.

    Leave a comment:


  • geoffrey.mcgill
    replied
    Hi selinc – We discussed the .d.ts generation during our team meeting today and agreed that it requires a major review. Much of the Bridge .d.ts generation was based on TypeScript 1.x syntax options.

    Our plan is to review this week and make some improvements.

    Leave a comment:

Working...
X