Skip to content

Commit 126c6ab

Browse files
authored
Fix easy misunderstanding "! ===" (microsoft#37838)
* Remove unnecessary Non-null assertion operator * Wrap Non-null assertion operator inside parentheses
1 parent e897eb1 commit 126c6ab

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/compiler/scanner.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,14 @@ namespace ts {
307307
/* @internal */ export function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget | undefined) {
308308
return languageVersion! >= ScriptTarget.ES2015 ?
309309
lookupInUnicodeMap(code, unicodeESNextIdentifierStart) :
310-
languageVersion! === ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
310+
languageVersion === ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) :
311311
lookupInUnicodeMap(code, unicodeES3IdentifierStart);
312312
}
313313

314314
function isUnicodeIdentifierPart(code: number, languageVersion: ScriptTarget | undefined) {
315315
return languageVersion! >= ScriptTarget.ES2015 ?
316316
lookupInUnicodeMap(code, unicodeESNextIdentifierPart) :
317-
languageVersion! === ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
317+
languageVersion === ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) :
318318
lookupInUnicodeMap(code, unicodeES3IdentifierPart);
319319
}
320320

src/services/codefixes/addMissingAwait.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace ts.codefix {
211211
reference;
212212
const diagnostic = find(diagnostics, diagnostic =>
213213
diagnostic.start === errorNode.getStart(sourceFile) &&
214-
diagnostic.start + diagnostic.length! === errorNode.getEnd());
214+
(diagnostic.start + diagnostic.length!) === errorNode.getEnd());
215215

216216
return diagnostic && contains(errorCodes, diagnostic.code) ||
217217
// A Promise is usually not correct in a binary expression (it’s not valid

0 commit comments

Comments
 (0)