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.
Quotes are flagged (and changed to backticks with --fix)
Expected behavior
The quotes remain as they are, because this version of TS does not narrow the type of v when using typeof with a backtick string, and does not compiler at all when using a backtick string as a literal type
The text was updated successfully, but these errors were encountered:
Typescript below the listed version fails compilation (or otherwise misbehaves) when backticks are used in some places where it succeeds in future versions. For instance, typeof str === `string` does not narrow the type of str in TS versions below 2.7.1, causing compilation errors if you try to use it as a string later. In the other cases, older TS throws errors where NoSubstitutionLiterals are used instead of single/double quoted strings, but works fine in above 2.7.1; rather than cripple the rule to support order versions, I split it up.
See the typeof issue here. Its milestone was 2.7 (hence the split in this PR).
And here's the issue for backticks strings as types. This one was 2.6, but rather than doing multiple splits, I just did one at 2.7.
Bug Report
TypeScript code being linted
with
tslint.json
configuration:Actual behavior
Quotes are flagged (and changed to backticks with --fix)
Expected behavior
The quotes remain as they are, because this version of TS does not narrow the type of v when using
typeof
with a backtick string, and does not compiler at all when using a backtick string as a literal typeThe text was updated successfully, but these errors were encountered: