Skip to content

valid-types: Handle inline imported TypeScript types #1210

Closed as not planned
Closed as not planned
@yvele

Description

@yvele

Motivation

Maybe related to #145

I'm using JavaScript (not TypeScript), but I still want to import TypeScript type in inline fashion.

Current behavior

Using:

/**
 * @returns {import("@slack/web/api").ChatPostMessageArguments}
 */

or

/**
 * @typedef {import("@slack/web/api").ChatPostMessageArguments} ChatPostMessageArguments
 */

Triggers the following error:

error Syntax error in type: import("@slack/web/api").ChatPostMessageArguments jsdoc/valid-types

Desired behavior

I want the ESLint JSDoc plugin to consider the inline TypeScript import as valid (although coding in JavaScript).

Note that Visual Studio code automatically created the @returns {import("@slack/web/api").ChatPostMessageArguments} so I consider it as valid.

Alternatives considered

/* eslint-disable jsdoc/valid-types */
/**
 * @returns {import("@slack/web/api").ChatPostMessageArguments}
 */
/* eslint-enable jsdoc/valid-types */

🤷

Any better workaround?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions