You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
constarray: SomeType<string,"hello">=[]// ~~~~~~~ [" should be `]constobj: {"kebab-case": string// ~~~~~~~~~~~~ [" should be `]}={"kebab-case": "value"}
Expected behavior
constarray: SomeType<string,"hello">=[]constobj: {"kebab-case": string}={"kebab-case": "value"// ~~~~~~~ [" should be `]}
Problem summary
The fixing/flagging here flags some things that when changed breaks typescript syntax and doesn't flag other instances where it should be flagged.
Typescript required that the string literal type passed to the generic type be single/double, but the implementation of the backtick rule does not make that distinction. Seems that node doesn't have a clear-cut type though to exclude it.
For the type definition, the kebab case property name has to remain single/double quotes, or typescript breaks as well. What is the associated node type there? Mucking in the code trying to PR for this, seems that the type definition property name here doesn't have a clean-cut node type either.
The string literal in the property value assignment is not flagged, but it should. Seems that looking at the parent node ("kebab-case": "value") gives you "PropertyAssignment" for both the property key and the property value, while the key should be ignored in this case, the value should not. How would one implement this part when they don't have their own node types?
This commit fixes the cases where export statements, string literal type as generic type parameter, and string literals in object literal property assignments were incorrectly flagged. This also fixes a small lint error (specifying a type parameter same as default).
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
The quotes get flagged (and changed to backticks if fix is enabled).
Expected behavior
The quotes should remain as double/single quotes, as typescript/ecma doesn't allow backticks here.
The text was updated successfully, but these errors were encountered: