Project DescriptionThe tool is to generate TypeScript typing (interfaces) for .Net classes that would be serialized by Json.Net.
Usage
using TypeScriptJson.Generator;
...
public class SomeModel
{
public int IntField;
public string StringProperty { get; set; }
public IEnumerable<SomeModel> EnumerableOfSomeModel;
public IDictionary<string, int?> Map;
}
...
var generator = new Generator();
generator.Context.MapType(typeof (SomeModel));
generator.GenerateToSingleFile("output.d.ts");
Output:
module ModuleName {
export interface SomeModel {
IntField: number;
EnumerableOfSomeModel: SomeModel[];
Map: { [key: string]: number; };
StringProperty: string;
}
}
Planned features
- MSBuild task
- Multiple output files (with cross references)
- Generics support (with TypeScript 0.9.x)
- NuGet package
- Unit tests
- Enum support
- Namespace/module mapping
- Multiple generation contexts