This is a Gulp plugin for generating Typescript *.d.ts files from C# classes. The generated d.ts files will declare a module named the same as the namespace the C# class resides in. The class will become a TypeScript interface named the same, but with an "I" in front of the name. The file will be named after the class.
Currently, each *.cs file must have only one class inside it. That class must only contain properties. Fields may work, but are as yet untested. Expression-bodied properties may work but, again, are untested.
npm install --save-dev gulp-csts
const csts = require("gulp-csts");
gulp.src("./path/to/csharp/classes/*.cs")
.pipe(csts({
outputDir: "./typings",
types: {
"MyUntypedClass": "any",
"MyClassTypedElsewhere": "IMyClassTypedElsewhere"
}
});
outputDir: required - tells csts the folder where it should output the*.d.tsfilestypes: optional - provides a set of custom type mappings, in case e.g. the typings have already been manually created