-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem
Current behavior
For now there is no specific ts-lint rule for type assertion.
This means both of these are valid:
const circle: Circle = shape as Circle
const circle: Circle = <Circle> shape;
Expected behavior
To increase consistency the rule "no-angle-bracket-type-assertion" should be enabled in /packages/stark-build/config/tslint.json
to enforce the first way of type assertion.
Or the other option can be chosen, but there no is rule available yet. (palantir/tslint#1228)
It is a choice between the two ways, but using as
has a slight preference. (Because of compatibility with JSX).
TypeScript documentation
TSLint documentation
Minimal reproduction of the problem with instructions
const circle: Circle = shape as Circle; // Passes
const circle: Circle = <Circle> shape; // Passes
What is the motivation / use case for changing the behavior?
Increasing consistency in the source code.
Environment
Angular CLI: 7.1.4
Node: 11.4.0
OS: darwin x64
Angular: 7.1.1
For Tooling issues:
- Node version: v11.4.0
- Platform: All
Others:
- TSLint: 5.11.0
- TypeScript: Version 3.2.2