ajafff/tslint-consistent-codestyle

no-as-type-assertion false positive for const assertions (ts 3.4)

Closed this issue · 1 comments

In typescript 3.4 new syntax was introduced - const assertions

// Type '"hello"'
let x = "hello" as const;

// Type 'readonly [10, 20]'
let y = [10, 20] as const;

// Type '{ readonly text: "hello" }'
let z = { text: "hello" } as const;

no-as-type-assertion highlights this usages as errors

That's because you also write it as <const>"hello"