Skip to content

JSDoc "nameless" @typedef on declaration does not work inside its own module #26626

Closed
@ikabirov

Description

@ikabirov

index.js

import {MyType} from "./MyType";

/**
 * @param {MyType} article
 */
function test(article) {
	article.custom; // error TS2339: Property 'custom' does not exist on type '{ src: string; }'.
}

MyType.js

/**
 * @typedef {{src: string}}
 */
let MyType;

/**
 * @param {MyType} article
 */
function test(article) {
	article.custom; // unknown type, no error
}

export {
	MyType,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specifically

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions