0

What I want to do looks like this:

/**
* @class OrganizationDescriptor
*/
export type OrganizationDescriptor = {|
  organizationId: string
|};

and then when I use this type as a parameter, document it:

/**
* @param {OrganizationDescriptor} descriptor.organizationId returns {@link OrganizationDescriptor}
*/

I tried assigning a function that returns an object with an organizationId string type. It does work, but it will require a lot of time editing my current codebase.

Is there a way to export type and use it as type reference of a parameter?

I run documentation v12.1.4 and run it using Node.js

vljs
  • 978
  • 7
  • 15

1 Answers1

0

Well, the answer is pretty easy. All I had to do is also transpile the types file and add some text to a type.

something like this,

/**
  * OrganizationDescriptor description
*/
export type OrganizationDescriptor = {|
  organizationId: string
|};

and use it as

 /**
   * @param {object} descriptor
   * @param {OrganizationDescriptor} descriptor.organizationId 
 */
 info(descriptor: ActivityDescriptor) {

worked for me.

You should also not forget that there is @type namepath available. Might be useful.

vljs
  • 978
  • 7
  • 15