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

Unexpected use-type-alias warning #856

Open
adelgado opened this issue May 20, 2019 · 0 comments
Open

Unexpected use-type-alias warning #856

adelgado opened this issue May 20, 2019 · 0 comments
Labels

Comments

@adelgado
Copy link

adelgado commented May 20, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants