I'm writing a grunt task in TypeScript. I'm trying to translate something I already have in JavaScript.
So, when grunt runs a task, it runs a function. When it runs, grunt sets this
to an object with useful properties, the same way that jQuery overloads this
with the element you are working on. I could access useful properties like this.files
;
grunt.registerMultiTask('clean', function() {
this.files.forEach(function(f) { Delete(f); });
});
So, "delete all the files in this.files
".
However, in TypeScript, I don't know if you can 'hint' to the compiler that this
is a particular type, so I don't get intellisense. How do I tell TypeScript to consider this
to be a different type?
question from:
https://stackoverflow.com/questions/65889651/how-to-type-a-function-which-is-on-proto-with-typescript 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…