Handle strict flag when writing tsbuildinfo (#44394)

* Add test showing how setting strict is not preserved in tsbuildinfo
Test for #44305

* Handle strict flag when writing tsbuildinfo
Fixes #44305

* Apply suggestions from code review

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>

Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
This commit is contained in:
Sheetal Nandi
2021-06-03 16:14:58 -07:00
committed by GitHub
parent 31f03f46f2
commit 9df7ecb38b
14 changed files with 194 additions and 47 deletions

View File

@@ -853,8 +853,14 @@ namespace ts {
const { optionsNameMap } = getOptionsNameMap();
for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
const optionInfo = optionsNameMap.get(name.toLowerCase());
if (optionInfo?.affectsEmit || optionInfo?.affectsSemanticDiagnostics || name === "skipLibCheck" || name === "skipDefaultLibCheck") {
const optionKey = name.toLowerCase();
const optionInfo = optionsNameMap.get(optionKey);
if (optionInfo?.affectsEmit || optionInfo?.affectsSemanticDiagnostics ||
// We need to store `strict`, even though it won't be examined directly, so that the
// flags it controls (e.g. `strictNullChecks`) will be retrieved correctly from the buildinfo
optionKey === "strict" ||
// We need to store these to determine whether `lib` files need to be rechecked.
optionKey === "skiplibcheck" || optionKey === "skipdefaultlibcheck") {
(result ||= {})[name] = convertToReusableCompilerOptionValue(
optionInfo,
options[name] as CompilerOptionsValue,

View File

@@ -566,6 +566,8 @@ namespace ts {
{
name: "strict",
type: "boolean",
// Though this affects semantic diagnostics, affectsSemanticDiagnostics is not set here
// The value of each strictFlag depends on own strictFlag value or this and never accessed directly.
showInSimplifiedHelpView: true,
category: Diagnostics.Type_Checking,
description: Diagnostics.Enable_all_strict_type_checking_options