Skip to content

Support JSDoc param destructuring #871

@nmussy

Description

@nmussy

🚀 Feature Request

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 0.18.0
  • Platform: all
  • I may be able to implement this feature request
  • This feature might incur a breaking change

Description

JSII doesn't allow JSDoc-ing destructured parameters. For example:

/**
 * @param bar Example description
 */
public foo({ a, b }: {[key: string]: string}) {
    console.log(a, b);
}

throws the following error:

warning TS9999: JSII: In doc block of 'foo', '@param bar' refers to a nonexistent parameter.

In a real-world use:

/**
 * Generate an Domain Name health check
 *
 * @param scope the parent Construct for this Construct
 * @param id the logical name of this Construct
 * @param props Domain name health check properties
 */
public static domainName(
    scope: Construct,
    id: string,
    { protocol, ...props }: DomainNameHealthCheckProps
) {
    return new EndpointHealthCheck(scope, id, { ...props, ...protocol.options });
}

Proposed Solution

Don't check the parameter name for destructured properties

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationThis is a problem with documentation.feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions