TypeSharp maps C# generic collections and types to their TypeScript equivalents.
| C# | TypeScript |
|---|---|
| List<T> | T[] |
| IList<T> | T[] |
| IEnumerable<T> | T[] |
| ICollection<T> | T[] |
| IReadOnlyList<T> | readonly T[] |
| HashSet<T> | T[] |
| ISet<T> | T[] |
| Dictionary<K, V> | Record<K, V> |
| IDictionary<K, V> | Record<K, V> |
| IReadOnlyDictionary<K, V> | Record<K, V> |
public class OrderDto { public List<string> Tags; public Dictionary<string, int> Meta; public IReadOnlyList<ItemDto> Items; }
export interface OrderDto { tags: string[]; meta: Record<string, number>; items: readonly ItemDto[]; }