Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueTuple not recognized #231

Closed
mskovacic opened this issue Oct 25, 2017 · 3 comments
Closed

ValueTuple not recognized #231

mskovacic opened this issue Oct 25, 2017 · 3 comments

Comments

@mskovacic
Copy link

mskovacic commented Oct 25, 2017

C# ValueTuple type is neither recognized in tst file nor Typewriter output.

input C# file:

[GenerateAsTypeScriptClass]
public class MyDTO
{
    public (string a, string b) P { get; set; }
}

generated TypeScript with default tst file:

class MyDTO {
    public p: 
}

When I change the tst file into

${
    using Typewriter.Extensions.Types;
    string TypeMap2(Property property)
    {
        var type = property.Type;
        return type.FullName+ ";";
    }
}

$Classes([GenerateAsTypeScriptClass])[
    class $Name {
        $Properties[public $name: $TypeMap2][;
        ]
    }
]

I get that ValueTuple isn't recognized even in the tst file, with the following output:

class MyDTO {
    public p: System.;
}
@Sc0tTyXL
Copy link

Seems this got added in 1.16 and not closed.

And I cannot find in the docs what the generated output will be.

@frhagn
Copy link
Owner

frhagn commented Nov 30, 2017

1.16.0 adds support for rendering ValueTuples in vs 2017, but it's still not possible to use them in Typewriter templates...

The output is an anonymous object, e.g.
public (string a, int b) MyTuple { get; set, }
will render
MyTuple: { a: string, b: number };

@frhagn frhagn closed this as completed Nov 30, 2017
@jeeshenlee
Copy link

I'm getting TupleValue in my generated TS file and fix it by overwriting it.

TupleValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants