3 ms·
The IDE will autocomplete selectKeyword but not "select". Other type systems, like TypeScript, support string literal types, and in Typescript we generally wou
by phamilton 7y ago
The IDE will autocomplete selectKeyword but not "select".
Other type systems, like TypeScript, support string literal types, and in Typescript we generally would just define the keyword type to be a union of string literals and then use those string literals in the code.
But without string literal types, using a string constant gives the compiler more information it can use to make sure your code is correct. That's a useful thing to have.