What is the "as syntax" pointed out by tslint?

Viewed 20660

I upgraded tslint and now it complains about:

ERROR: src/Metronome/JobFetcher.ts[13, 32]: Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.

The offending code looks like:

const jobs = <JobConfig[]> <any> await rp(fetchJobsOptions);

What is the as syntax though and why should I use it?

2 Answers

If you want to suppress the error, you can as well go to tslint.json and include

...
"rules": {
    "no-angle-bracket-type-assertion": false,
    ...
}
...

provided you don't mind consistence as said.

Related