Code review comments
This commit is contained in:
parent
fb218b7897
commit
e9f82145b7
|
@ -5880,11 +5880,11 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
const checkJsDirectiveRegEx = /^\/\/\/?\s*@check(\s+(true|false))?/gim;
|
||||
const checkJsDirectiveRegEx = /^\/\/\/?\s*(@ts-check|@ts-nocheck)\s*$/gim;
|
||||
const checkJsDirectiveMatchResult = checkJsDirectiveRegEx.exec(comment);
|
||||
if (checkJsDirectiveMatchResult) {
|
||||
checkJsDirective = {
|
||||
enabled: compareStrings(checkJsDirectiveMatchResult[2], "false", /*ignoreCase*/ true) !== Comparison.EqualTo,
|
||||
enabled: compareStrings(checkJsDirectiveMatchResult[1], "@ts-check", /*ignoreCase*/ true) === Comparison.EqualTo,
|
||||
end: range.end,
|
||||
pos: range.pos
|
||||
};
|
||||
|
|
|
@ -904,7 +904,7 @@ namespace ts {
|
|||
|
||||
Debug.assert(!!sourceFile.bindDiagnostics);
|
||||
const bindDiagnostics = sourceFile.bindDiagnostics;
|
||||
// For JavaScript files, we don't want to report semantic errors unless ecplicitlly requested.
|
||||
// For JavaScript files, we don't want to report semantic errors unless explicitly requested.
|
||||
const includeCheckDiagnostics = !isSourceFileJavaScript(sourceFile) ||
|
||||
(sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : options.checkJs);
|
||||
const checkDiagnostics = includeCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : [];
|
||||
|
|
|
@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
|
|||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
|
||||
// @check
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
|
|
|
@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
|
|||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
|
||||
// @check
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
|
|
|
@ -3,7 +3,7 @@ tests/cases/compiler/a.js(4,1): error TS2322: Type '0' is not assignable to type
|
|||
|
||||
==== tests/cases/compiler/a.js (1 errors) ====
|
||||
|
||||
// @check true
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
||||
~
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
|
||||
// @check false
|
||||
// @ts-nocheck
|
||||
var x = "string";
|
||||
>x : Symbol(x, Decl(a.js, 2, 3))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
|
||||
// @check false
|
||||
// @ts-nocheck
|
||||
var x = "string";
|
||||
>x : string
|
||||
>"string" : "string"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
// @noEmit: true
|
||||
|
||||
// @fileName: a.js
|
||||
// @check
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
|
@ -2,6 +2,6 @@
|
|||
// @noEmit: true
|
||||
|
||||
// @fileName: a.js
|
||||
// @check
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
|
@ -3,6 +3,6 @@
|
|||
// @noEmit: true
|
||||
|
||||
// @fileName: a.js
|
||||
// @check true
|
||||
// @ts-check
|
||||
var x = "string";
|
||||
x = 0;
|
|
@ -3,6 +3,6 @@
|
|||
// @noEmit: true
|
||||
|
||||
// @fileName: a.js
|
||||
// @check false
|
||||
// @ts-nocheck
|
||||
var x = "string";
|
||||
x = 0;
|
Loading…
Reference in a new issue