I'm using Angular 1 in VScode. I have a main file that defines all my services, controllers etc and require's them against Angular.
angular.module('myApp', [])
.service('myService', require('./myService.js')
.controller('myController', require('./myController.js');
and the service:
class MyService {
constructor() {}
}
module.exports = MyService;
and my controller
class MyController {
constructor(myService) {
/** @type {MyService} */
this.myService = myService;
}
}
module.exports = MyController;
As a result intellisense has no idea what myService is within the controller. I had hoped that the jsDoc comment would have solved this issue as both files are within the same work-space but it does not.
I have seen the type-def comment and tried writing a custom type in the service file :/** {MyService} CustomService */ then reference the CustomService type in my controller but that doesn't work either.
In Short
Is it possible, using jsDoc in VSCode to reference a class from a different file without requiring it into the current working file.
Thanks for any insight all.
No, as of VScode 1.14 this is not possible but we are tracking a discussion of this functionality here: https://github.com/Microsoft/TypeScript/issues/14377
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With