7

In my file lib/server.js I have the following code:

/**
 * My Test Server
 * 
 * @typedef  {Object}   My.Server
 * @prop     {String}   name
 */
function Server() {
    this.name = 'zever';
}

When I reference this @typedef in the same file, it works:

piece of code showing intelliSense is using the typedef in the same file

However, when I use the @typedef in another file in the same project, I get nothing:

type is not working in another file in the same project

(And yes, I tried the jsdoc on a single line, too)

What is going wrong here?

Jelle De Loecker
  • 20,999
  • 27
  • 100
  • 142
  • 1
    Possible duplicate of [How to "import" a typedef from one file to another in JSDoc using Node.js?](https://stackoverflow.com/questions/49836644/how-to-import-a-typedef-from-one-file-to-another-in-jsdoc-using-node-js) – Alexis Tyler Aug 26 '19 at 05:43

1 Answers1

1

This helped me: https://stackoverflow.com/a/52847569/1554499 .

You need to import your definition in the other file:

 /**
 @typedef {import('./my-new-type').MyNewType} MyNewType
 * */
Pavel Polyakov
  • 866
  • 1
  • 8
  • 13