Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Unexpected use-type-alias warning #856

@adelgado

Description

@adelgado

I want to report a bug.

SonarTS version: 1.9.0

Node.js version: 8.12.0

TypeScript version: 3.3.3333

TSLint version: 5.12.1

Rule key: use-type-alias

Reproducer

class Frobber<T, U, V> {
  private frobee: T & U & V // Replace this intersection type with a type alias. It is also used on lines 3,4. (use-type-alias)
  private frobee2: T & U & V  
  private frobee3: T & U & V

  constructor() { }
}

I want to provide the following feedback.

It could very well be that there's some sort of technique of which I'm not aware, in which case I'd be glad to be pointed in the right direction.

The use-type-alias rule suggests me to create a type alias for the T & U & V type. However, these types being parametric to the class in which they're used, I don't think this is actually possible. I've tried defining the type in the body of the class but this is not grammatical. Outside of the class I don't have a reference to the parametric types.

I believe this is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions