Closed
Description
π 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
π» 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
Labels
No labels