Skip to content

Warning 6133 ignores @link tags on enum membersΒ #61183

Closed
@Danielku15

Description

@Danielku15

πŸ”Ž Search Terms

  • link
  • is declared but its value is never read. (6133)
  • TS6133

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ (all items on 2025-02-15)

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.0-dev.20250215#code/JYWwDg9gTgLgBDAnmApnA3nACgQxgCwBlgBrNAXzgDMoIQ4ByKgZwYG4BYAKFElgWRpMuAgHkoAMWAAbFABEUzAMZRgYGNDiUadRi3bde0eElQY4AFVApiZLdVr0mrTj3DGBZzACEArlSoUKABRADslCAATYFCAc1F1YAhQ+x0nfVcjflMhOFEAIwArFCUYMIjouISYJNDmVMc9F0N3bMFzcqiY+MTkht1nAy5uAHoAKjHuODGMAAFpGJJsPCJSFHIpsZHuFAAPPngUUN96MJOMKbgr8cmuK-uZ9HnF5bFJGXlFFTUNKA27+7TbYAq5nEAANRw0l8KG4-x2+w8cBiMCCVBwSjQAElQqioOjMRcQXAbpcHnMFqEllYQDY1v9AUCydRgChpJEAFzHED5IKuZmk4nTCkvAByEFwUBwIAAwlDpPkMSQGYCtszaQQogAKACUHIAbhBgJFXPCuHsDnAlNIcMx6jKbXaiYDBYzHs8qXA-AEgp1Kj0askVQ9gYCqKz2VyTryoHAALxwAAM-OJrtVIs9BWKpT93WqtWYwauauJGvw2r1huN5jNLomzOFT0pS1zVV6oSLTOJETqMCgvlK0F1NbhQA

πŸ’» Code

import type { PathLike } from 'fs';
import type { PathOrFileDescriptor } from 'fs';
import type { TimeLike } from 'fs';
import type { BufferEncodingOption } from 'fs';
import type { ObjectEncodingOptions } from 'fs';
import type { EncodingOption } from 'fs';

/**
 * {@link PathLike}
 */
export enum Enum {
    /**
     * {@link PathOrFileDescriptor}
     */
    EnumValue
}

export  interface Interface {
    /**
     * {@link TimeLike}
     */
    field:number;

    /**
     * {@link NoParamCallback}
     */
    method():void;
}

export class Class {
    /**
     * {@link BufferEncodingOption}
     */
    field:number = 0;

    /**
     * {@link ObjectEncodingOptions}
     */
    method():void { }

    /**
     * {@link EncodingOption}
     */
    constructor() { }
}

πŸ™ Actual behavior

What happened: TypeScript reports a type to not be used when referenced in the @link TS Doc of an enum value:

'PathOrFileDescriptor' is declared but its value is never read.(6133)

Why it was wrong: The type is used in TSDocs and should not be flagged as unread. The behavior is inconsistent with all other code elements.

πŸ™‚ Expected behavior

What I expect to happen: There should not be any warning about the type being unused.
Why: Removing the import results in wrong linked references. The behavior is inconsistent with all other code elements I tested.

Additional information about the issue

The initial fix to respect the @link tags were introduced in TypeScript 4.8 but it seems it did not cover enum members. See:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions