Prettier: TypeScript: random semi-colon despite no `semi`

Created on 7 Jun 2017  路  3Comments  路  Source: prettier/prettier

I'm not sure how to best describe it so see: https://prettier.github.io/prettier/#%7B%22content%22%3A%22export%20class%20Mutation%20%7B%5Cn%20%20%20%20private%20set%3A%20NQuad%5B%5D%3B%5Cn%20%20%20%20private%20delete%3A%20NQuad%5B%5D%3B%5Cn%7D%22%2C%22options%22%3A%7B%22printWidth%22%3A80%2C%22tabWidth%22%3A2%2C%22singleQuote%22%3Atrue%2C%22trailingComma%22%3A%22none%22%2C%22bracketSpacing%22%3Afalse%2C%22jsxBracketSameLine%22%3Afalse%2C%22parser%22%3A%22typescript%22%2C%22semi%22%3Afalse%2C%22useTabs%22%3Afalse%2C%22doc%22%3Afalse%7D%7D

Input:

export class Mutation {
    private set: NQuad[];
    private delete: NQuad[];
}

Output:

export class Mutation {
    private set: NQuad[];
    private delete: NQuad[]
}

Expected

export class Mutation {
    private set: NQuad[]
    private delete: NQuad[]
}

This happens even when there are no semi-colons to begin with. And it appears to only happen when we name the property set. If we call it something else, no semi-colon will be added. I believe it is conflicting with some reserve keyword?

locked-due-to-inactivity bug

All 3 comments

Yeah, if there's just set, then it can be interpreted differently. But in this case there's private and : NQuad[] that remove the ambiguity, so we should be good without a ;

That was fast.

I just published 1.4.3 which fixes it. Thanks for reporting it!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tjvr picture tjvr  路  3Comments

grgur picture grgur  路  3Comments

ikatyang picture ikatyang  路  3Comments

jfmengels picture jfmengels  路  3Comments

fingermark picture fingermark  路  3Comments