In my project, I am trying to implement a parameter similar to what we do in C# with Typescript. However, I encountered an issue while attempting to use Typescript for this purpose.
I got stuck at the line of code
Result<class1> modelObj=API_result;
in Typescript, but I was able to create the Model successfully.
C#:
public class Result<T> {
[JsonProperty("recordsTotal")]
public int recordsTotal { get; set; }
[JsonProperty("recordsFiltered")]
public int recordsFiltered { get; set; }
[JsonProperty("data")]
public IEnumerable<T> data { get; set; }}
}
TypeScript:
export interface Result<T> {
recordsTotal: number;
recordsFiltered: number;
data: T[];
}
export interface class1 {
lng_id:number,
str_name:string,
//dtresult:DtResult[class1]
}
Help needed on converting this to Angular TypeScript