Do we have to declare / import every single .net type we want to work with?! With every signature?
// Call .NET types directly from TypeScript
@DotNetType("System.Text.StringBuilder")
declare class StringBuilder {
constructor();
append(value: string): StringBuilder;
toString(): string;
}
@DotNetType("System.TimeSpan")
declare class TimeSpan {
static fromHours(value: number): TimeSpan;
readonly totalMinutes: number;
}
const sb = new StringBuilder();
sb.append("1.5 hours = ");
sb.append(`${TimeSpan.fromHours(1.5).totalMinutes} minutes`);
console.log(sb.toString());
I work with hundreds and hundreds of .net types daily - this is a monumental task to declare each type. Is there a plan to auto-import this with usings statements down the road ? maybe a usings.ts file so that the regular .ts files don't even need an import statements? Or perhaps a source generator to read the BCL from an import statement and generate a typescript .net definitions on build (caching of course)? Not sure how F# does it - but that's a massive hurdle to using this library and will stifle adoption outside of a playground scenario.
Do we have to declare / import every single .net type we want to work with?! With every signature?
I work with hundreds and hundreds of .net types daily - this is a monumental task to declare each type. Is there a plan to auto-import this with usings statements down the road ? maybe a usings.ts file so that the regular .ts files don't even need an
importstatements? Or perhaps a source generator to read the BCL from animportstatement and generate a typescript .net definitions on build (caching of course)? Not sure how F# does it - but that's a massive hurdle to using this library and will stifle adoption outside of a playground scenario.