jburzynski / TypeGen

Single-class-per-file C# to TypeScript generator
MIT License
197 stars 56 forks source link

Invalid export for `System.Tuple` type #187

Open valdisiljuconoks opened 10 months ago

valdisiljuconoks commented 10 months ago

There seems to be an issue exporting Tuple type.

Tools

TypeGen v5.0.1 .NET v8

Model

[ExportTsInterface]
public class ResponseDtoWithTupleDataType
{
    public Tuple<string, decimal>[] SomeDataPoints { get; set; }
}

Exported Type

/**
 * This is a TypeGen auto-generated file.
 * Any changes made to this file can be lost when this file is regenerated.
 */

import { IStructuralEquatable } from './IStructuralEquatable.generated';
import { IStructuralComparable } from './IStructuralComparable.generated';
import { ITupleInternal } from './ITupleInternal.generated';
import { ITuple } from './ITuple.generated';

export class Tuple<T1, T2> implements IStructuralEquatable, IStructuralComparable, ITupleInternal, ITuple {
  item1: T1;
  item2: T2;
}

Error

TS2420  (TS) Class 'Tuple<T1, T2>' incorrectly implements interface 'ITuple'.
  Type 'Tuple<T1, T2>' is missing the following properties from type 'ITuple': length, item

C:\TypeGenInheritanceWithGenerics\TypeGenInheritanceWithGenerics\types\webapi\Tuple.generated.ts    11  
valdisiljuconoks commented 10 months ago

Sample repo: https://github.com/valdisiljuconoks/TypeGenInheritanceWithGenerics/blob/master/TypeGenInheritanceWithGenerics/Models/ResponseDtoWithTupleDataType.cs