Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent-abbreviations: TypeScript type references are not considered by autofixer, interfaces and type aliases not checked #766

Open
felixfbecker opened this issue Jun 3, 2020 · 1 comment
Labels

Comments

@felixfbecker
Copy link

enum Btn {
    Hello = 123,
}
const test1 = Btn.Hello
let test2: Btn.Hello

Gets autofixed to:

enum Button {
    Hello = 123,
}
const test1 = Button.Hello
let test2: Btn.Hello
function test3(testParameter: Btn): Btn {
    return Button.Hello
}

Note how the value positions are fixed, but the type positions are not.

Same with classes:

class Btn {}
const test1 = new Btn()
let test2: Btn
function test3(testParameter: Btn): Btn {
    return new Btn()
}

fixed:

class Button {}
const test1 = new Button()
let test2: Btn
function test3(testParameter: Btn): Btn {
    return new Button()
}

Interfaces and type aliases do not get flagged at all:

interface Btn {}
type Btn2 = {}

(no error)

@Shakeskeyboarde
Copy link

This one is more important than it might seem given how much traction typescript is gaining.

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

No branches or pull requests

3 participants