This repository has been archived by the owner on May 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a8a9e
commit 3d3af4f
Showing
3 changed files
with
593 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,53 @@ | ||
namespace T4TS | ||
| ||
namespace T4TS | ||
{ | ||
using System; | ||
using System.CodeDom; | ||
using System.CodeDom.Compiler; | ||
|
||
[GeneratedCode("T4TS", "0.1")] | ||
public class TypeScriptInterfaceAttribute : Attribute | ||
/// <summary> | ||
/// Add this attribute to a class to generate a corresponding TypeScript interface. | ||
/// </summary> | ||
[GeneratedCode("T4TS", "1.0")] | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)] | ||
public class TypeScriptInterfaceAttribute: Attribute | ||
{ | ||
public TypeScriptInterfaceAttribute() | ||
{ | ||
} | ||
/// <summary> | ||
/// Specifies which module the interface should be placed. | ||
/// The default module will be used if not specified. | ||
/// </summary> | ||
public string Module { get; set; } | ||
|
||
/// <summary> | ||
/// The name of the interface. | ||
/// If not specified, the name of the class will be used. | ||
/// </summary> | ||
public string Name { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Add this attribute to a property to customize the generated interface member | ||
/// </summary> | ||
[GeneratedCode("T4TS", "1.0")] | ||
[AttributeUsage(AttributeTargets.Property, AllowMultiple=false, Inherited=true)] | ||
public class TypeScriptMemberAttribute: Attribute | ||
{ | ||
/// <summary> | ||
/// The member name in the interface. | ||
/// If not specified, the property name will be used. | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
/// <summary> | ||
/// Specify if the member should be optional, ie. "name?: type". | ||
/// If not specified, the default value will be used. | ||
/// </summary> | ||
public bool Optional { get; set; } | ||
|
||
/// <summary> | ||
/// Specify which type the interface member will have. | ||
/// If not specified, a suitable type will be determined. | ||
/// </summary> | ||
public string Type { get; set; } | ||
} | ||
} |
Oops, something went wrong.