What is the "no string literal" rule in tslint?

The description found here is very short:

Denies access to objects via string literals.

Is there any additional documentation or an example?

+5
source share
1 answer

This means that you cannot access objects using parenthesis notation. For instance:

object["property"] 

Thus, a simple typo will cause an error and should therefore be avoided. Instead, strongly typed access is recommended.

+4
source

Source: https://habr.com/ru/post/1247366/


All Articles