Repro
{
"rules": {
"@typescript-eslint/no-empty-interface": ["error"]
}
}
interface RecursiveStrings extends Array<RecursiveStrings | string> {}
Expected Result
No error, because the recommended alternative type RecursiveStrings = Array<RecursiveStrings | string> is not valid. If the extended type contains the current type, the error should not appear.
Actual Result
error: An interface declaring no members is equivalent to its supertype (@typescript-eslint/no-empty-interface)
Additional Info
This also applies to more complex circular structures which might be harder to detect, but the form demonstrated above is the most common.
Versions
| package | version |
| ---------------------------------- | ------- |
| @typescript-eslint/eslint-plugin | 1.13.0 |
| @typescript-eslint/parser | 1.13.0 |
| TypeScript | 3.5.3 |
| ESLint | 5.16.0 |
| node | 12.9.1 |
| npm | 6.10.3 |
We could probably add support for simple cases, but for more complex ones it's probably better to just use an eslint-disable-next-line comment
I don't think we'll have to support this!
Planned for typescript 3.7 is the ability to do recursive type references!
https://github.com/microsoft/TypeScript/pull/33050
This can probably be closed now.