Ok, got it. After I posted this question, I continued to search the Internet and an hour or so later got into this article on StrongLoop by Sequoia McDowell: https://strongloop.com/strongblog/type-hinting-in-javascript/
I watched him closely and, using the "typings" package, I managed to initialize the "typings" folder in the root of my project. The contents of this folder now look like this:
typings/ βββ models/ β βββ myObject.d.ts βββ index.d.ts
The contents of this index.d.ts file are as follows:
And the contents of this myObject.d.ts file look something like this:
declare namespace MyProject { export interface MyObject { aString?: string; anotherString?: string; aComplexType?: ComplexType; } interface ComplexType { aString?: string; anotherComplexType: SecondComplexType; } interface SecondComplexType { aString?: string; } }
With this, I had to start tagging instances of this object using JSDoc. This document basically took two forms:
constructor(myObject) { this.myObject = myObject; } function noOp(myObject) { return myObject; }
and
const myObject = containerObject.myObject;
With this installation and the latest public version of VSCode, I was able to see errors in the ES6 * .js files that I was currently editing, and said which attributes do not exist, which were assigned values ββof the wrong type, which were considered the wrong type, etc.
On the halfway.
After some research, I realized that this is not a completely unique VSCode feature. It looks like they are using tslint or some kind of individual version. Working with this knowledge, I added "tslint" to the project and developed this npm script:
"tslint": "tslint --type-check --project tsconfig.json"
Here is the contents of tsconfig.json that I landed on, although I'm not entirely sure that all of these options are necessary.
{ "compilerOptions": { "target": "es6", "allowJs": true, "noResolve": true, "checkJs": true, "moduleResolution": "node", "types": [ "node" ] }, "exclude": [ "node_modules", "coverage", "lib", "spec" ] }
Running this "tslint" script using this tsconfig.json, and the type definition files in the "typings" folder allow me to enter the type of one type of object in all project files with the proper JSDoc. I ran into a small problem , but it looks like it was fixed and merged about an hour ago, by coincidence. In addition to the type of checking the fields of the object, it also revealed a couple of places where the attribute was prematurely pulled from the object whose descendant did have this attribute. Very cool.
TL; DR: This can be done, thank you very much Sequoia McDowell for this article, which finally put me on the right track.