kswoll / WootzJs

C# to Javascript Compiler implemented via Roslyn
MIT License
110 stars 21 forks source link

Omit generic arguments #30

Open AndersMalmgren opened 8 years ago

AndersMalmgren commented 8 years ago

Hi. I finally got time to get wootzjs to build. Very cool. I'm trying to write a export class for KnockoutJS. This my my code sofar

    [Js(Export = false, Name ="ko")]
    public static class Ko
    {
        [Js(Export = false, Inline ="ko.observable()")]
        public static extern Observable<T> Observable<T>();

        [Js(Export = false, Name = "observable")]
        public static extern Observable<T> Observable<T>(T value);
    }

    public class Observable<T>
    {

    }

doing var foo = Ko.Observable(); will result in javascript var var foo = ko.observable(); thansk to the Inline attribute. But that wont work for the second method becasue it need to pass the argument variable. ommiting the Inline argument and calling var ob2 = Ko.Observable("foo"); will output var ob2 = ko.observable(String, "foo");

This will fail becasue ko.observable wants ko.observable("foo");

Can I somehow omit generic arguments?