typescript 4.9.0-dev.20220827 → 4.9.0-dev.20220828

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Die Konvertierung des Typs \"{0}\" in den Typ \"{1}\" kann ein Fehler sein, weil die Typen keine ausreichende Überschneidung aufweisen. Wenn dies beabsichtigt war, konvertieren Sie den Ausdruck zuerst in \"unknown\".",
431
431
  "Convert_0_to_1_in_0_95003": "\"{0}\" in \"{1} in {0}\" konvertieren",
432
432
  "Convert_0_to_mapped_object_type_95055": "\"{0}\" in zugeordneten Objekttyp konvertieren",
433
+ "Convert_all_const_to_let_95102": "Alle \"const\" in \"let\" konvertieren",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "Alle Konstruktorfunktionen in Klassen konvertieren",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Alle nicht als Wert verwendeten Importe in reine Typenimporte konvertieren",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Alle ungültigen Zeichen in HTML-Entitätscode konvertieren",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversión del tipo \"{0}\" al tipo \"{1}\" puede ser un error, porque ninguno de los tipos se superpone suficientemente al otro. Si esto era intencionado, convierta primero la expresión en \"unknown\".",
431
431
  "Convert_0_to_1_in_0_95003": "Convertir \"{0}\" a \"{1} en \"{0}\"",
432
432
  "Convert_0_to_mapped_object_type_95055": "Convertir \"{0}\" en el tipo de objeto asignado",
433
+ "Convert_all_const_to_let_95102": "Convertir todo \"const\" en \"let\"",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "Convertir todas las funciones de constructor en clases",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertir todas las importaciones no usadas como valor para las importaciones solo de tipo",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertir todos los caracteres no válidos al código de entidad HTML",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversione del tipo '{0}' nel tipo '{1}' può essere un errore perché nessuno dei due tipi si sovrappone sufficientemente all'altro. Se questa opzione è intenzionale, convertire prima l'espressione in 'unknown'.",
431
431
  "Convert_0_to_1_in_0_95003": "Convertire '{0}' in '{1} in {0}'",
432
432
  "Convert_0_to_mapped_object_type_95055": "Convertire '{0}' nel tipo di oggetto con mapping",
433
+ "Convert_all_const_to_let_95102": "Convertire ogni 'const' in 'let'",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "Convertire tutte le funzioni di costruttore in classi",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertire tutte le importazioni non usate come valore in importazioni solo di tipi",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertire tutti i caratteri non validi nel codice entità HTML",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "型 '{0}' から型 '{1}' への変換は、互いに十分に重複できないため間違っている可能性があります。意図的にそうする場合は、まず式を 'unknown' に変換してください。",
431
431
  "Convert_0_to_1_in_0_95003": "'{0}' を '{0} の {1}' に変換します",
432
432
  "Convert_0_to_mapped_object_type_95055": "'{0}' をマップされたオブジェクト型に変換する",
433
+ "Convert_all_const_to_let_95102": "すべての 'const' を 'let' に変換する",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "すべてのコンストラクター関数をクラスに変換します",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "値として使用されていないすべてのインポートを型のみのインポートに変換する",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "すべての無効な文字を HTML エンティティ コードに変換する",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "'{0}' 형식을 '{1}' 형식으로 변환한 작업은 실수일 수 있습니다. 두 형식이 서로 충분히 겹치지 않기 때문입니다. 의도적으로 변환한 경우에는 먼저 'unknown'으로 식을 변환합니다.",
431
431
  "Convert_0_to_1_in_0_95003": "'{0}'을(를) '{0}의 {1}'(으)로 변환",
432
432
  "Convert_0_to_mapped_object_type_95055": "'{0}'을(를) 매핑된 개체 형식으로 변환",
433
+ "Convert_all_const_to_let_95102": "모든 'const'를 'let'으로 변환",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "모든 생성자 함수를 클래스로 변환",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "값으로 사용되지 않는 모든 가져오기를 형식 전용 가져오기로 변환",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "모든 잘못된 문자를 HTML 엔터티 코드로 변환",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "A conversão do tipo '{0}' para o tipo '{1}' pode ser um erro porque nenhum tipo está suficientemente sobreposto ao outro. Se isso era intencional, converta a expressão para 'unknown' primeiro.",
431
431
  "Convert_0_to_1_in_0_95003": "Converter '{0}' em '{1} em {0}'",
432
432
  "Convert_0_to_mapped_object_type_95055": "Converter '{0}' para o tipo de objeto mapeado",
433
+ "Convert_all_const_to_let_95102": "Converta todos os 'const' para 'let'",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "Converter todas as funções de construtor em classes",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Converter todas as importações não usadas como um valor para importações somente de tipo",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Converter todos os caracteres inválidos em código de entidade HTML",
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Преобразование типа \"{0}\" в тип \"{1}\" может привести к ошибке, так как ни один из типов не перекрывается с другим в достаточной степени. Если это сделано намеренно, сначала преобразуйте выражение в \"unknown\".",
431
431
  "Convert_0_to_1_in_0_95003": "Преобразовать \"{0}\" в \"{1} в {0}\"",
432
432
  "Convert_0_to_mapped_object_type_95055": "Преобразовать \"{0}\" в тип сопоставленного объекта",
433
+ "Convert_all_const_to_let_95102": "Преобразовать все \"const\" в \"let\"",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "Преобразовать все функции конструктора в классы",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Преобразовать все импорты, не используемые в качестве значения, в импорты, затрагивающие только тип",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Преобразовать все недопустимые символы в код сущности HTML",
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -67134,7 +67134,7 @@ var ts;
67134
67134
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) {
67135
67135
  parent = parent.parent;
67136
67136
  }
67137
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
67137
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
67138
67138
  }
67139
67139
  checkTruthinessOfType(leftType, node.left);
67140
67140
  }
@@ -67602,8 +67602,8 @@ var ts;
67602
67602
  }
67603
67603
  }
67604
67604
  function checkConditionalExpression(node, checkMode) {
67605
- checkTruthinessExpression(node.condition);
67606
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
67605
+ var type = checkTruthinessExpression(node.condition);
67606
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
67607
67607
  var type1 = checkExpression(node.whenTrue, checkMode);
67608
67608
  var type2 = checkExpression(node.whenFalse, checkMode);
67609
67609
  return getUnionType([type1, type2], 2);
@@ -70449,15 +70449,15 @@ var ts;
70449
70449
  }
70450
70450
  function checkIfStatement(node) {
70451
70451
  checkGrammarStatementInAmbientContext(node);
70452
- checkTruthinessExpression(node.expression);
70453
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
70452
+ var type = checkTruthinessExpression(node.expression);
70453
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
70454
70454
  checkSourceElement(node.thenStatement);
70455
70455
  if (node.thenStatement.kind === 238) {
70456
70456
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
70457
70457
  }
70458
70458
  checkSourceElement(node.elseStatement);
70459
70459
  }
70460
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
70460
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
70461
70461
  if (!strictNullChecks)
70462
70462
  return;
70463
70463
  helper(condExpr, body);
@@ -70472,7 +70472,7 @@ var ts;
70472
70472
  : condExpr;
70473
70473
  if (ts.isModuleExportsAccessExpression(location))
70474
70474
  return;
70475
- var type = checkTruthinessExpression(location);
70475
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
70476
70476
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
70477
70477
  if (!(getTypeFacts(type) & 4194304) || isPropertyExpressionCast)
70478
70478
  return;
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -80064,7 +80064,7 @@ var ts;
80064
80064
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) {
80065
80065
  parent = parent.parent;
80066
80066
  }
80067
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80067
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80068
80068
  }
80069
80069
  checkTruthinessOfType(leftType, node.left);
80070
80070
  }
@@ -80575,8 +80575,8 @@ var ts;
80575
80575
  }
80576
80576
  }
80577
80577
  function checkConditionalExpression(node, checkMode) {
80578
- checkTruthinessExpression(node.condition);
80579
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
80578
+ var type = checkTruthinessExpression(node.condition);
80579
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
80580
80580
  var type1 = checkExpression(node.whenTrue, checkMode);
80581
80581
  var type2 = checkExpression(node.whenFalse, checkMode);
80582
80582
  return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */);
@@ -83916,15 +83916,15 @@ var ts;
83916
83916
  function checkIfStatement(node) {
83917
83917
  // Grammar checking
83918
83918
  checkGrammarStatementInAmbientContext(node);
83919
- checkTruthinessExpression(node.expression);
83920
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
83919
+ var type = checkTruthinessExpression(node.expression);
83920
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
83921
83921
  checkSourceElement(node.thenStatement);
83922
83922
  if (node.thenStatement.kind === 238 /* SyntaxKind.EmptyStatement */) {
83923
83923
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
83924
83924
  }
83925
83925
  checkSourceElement(node.elseStatement);
83926
83926
  }
83927
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
83927
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
83928
83928
  if (!strictNullChecks)
83929
83929
  return;
83930
83930
  helper(condExpr, body);
@@ -83939,7 +83939,7 @@ var ts;
83939
83939
  : condExpr;
83940
83940
  if (ts.isModuleExportsAccessExpression(location))
83941
83941
  return;
83942
- var type = checkTruthinessExpression(location);
83942
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
83943
83943
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
83944
83944
  if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
83945
83945
  return;
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -80063,7 +80063,7 @@ var ts;
80063
80063
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) {
80064
80064
  parent = parent.parent;
80065
80065
  }
80066
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80066
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80067
80067
  }
80068
80068
  checkTruthinessOfType(leftType, node.left);
80069
80069
  }
@@ -80574,8 +80574,8 @@ var ts;
80574
80574
  }
80575
80575
  }
80576
80576
  function checkConditionalExpression(node, checkMode) {
80577
- checkTruthinessExpression(node.condition);
80578
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
80577
+ var type = checkTruthinessExpression(node.condition);
80578
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
80579
80579
  var type1 = checkExpression(node.whenTrue, checkMode);
80580
80580
  var type2 = checkExpression(node.whenFalse, checkMode);
80581
80581
  return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */);
@@ -83915,15 +83915,15 @@ var ts;
83915
83915
  function checkIfStatement(node) {
83916
83916
  // Grammar checking
83917
83917
  checkGrammarStatementInAmbientContext(node);
83918
- checkTruthinessExpression(node.expression);
83919
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
83918
+ var type = checkTruthinessExpression(node.expression);
83919
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
83920
83920
  checkSourceElement(node.thenStatement);
83921
83921
  if (node.thenStatement.kind === 238 /* SyntaxKind.EmptyStatement */) {
83922
83922
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
83923
83923
  }
83924
83924
  checkSourceElement(node.elseStatement);
83925
83925
  }
83926
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
83926
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
83927
83927
  if (!strictNullChecks)
83928
83928
  return;
83929
83929
  helper(condExpr, body);
@@ -83938,7 +83938,7 @@ var ts;
83938
83938
  : condExpr;
83939
83939
  if (ts.isModuleExportsAccessExpression(location))
83940
83940
  return;
83941
- var type = checkTruthinessExpression(location);
83941
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
83942
83942
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
83943
83943
  if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
83944
83944
  return;
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -80054,7 +80054,7 @@ var ts;
80054
80054
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) {
80055
80055
  parent = parent.parent;
80056
80056
  }
80057
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80057
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80058
80058
  }
80059
80059
  checkTruthinessOfType(leftType, node.left);
80060
80060
  }
@@ -80565,8 +80565,8 @@ var ts;
80565
80565
  }
80566
80566
  }
80567
80567
  function checkConditionalExpression(node, checkMode) {
80568
- checkTruthinessExpression(node.condition);
80569
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
80568
+ var type = checkTruthinessExpression(node.condition);
80569
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
80570
80570
  var type1 = checkExpression(node.whenTrue, checkMode);
80571
80571
  var type2 = checkExpression(node.whenFalse, checkMode);
80572
80572
  return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */);
@@ -83906,15 +83906,15 @@ var ts;
83906
83906
  function checkIfStatement(node) {
83907
83907
  // Grammar checking
83908
83908
  checkGrammarStatementInAmbientContext(node);
83909
- checkTruthinessExpression(node.expression);
83910
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
83909
+ var type = checkTruthinessExpression(node.expression);
83910
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
83911
83911
  checkSourceElement(node.thenStatement);
83912
83912
  if (node.thenStatement.kind === 238 /* SyntaxKind.EmptyStatement */) {
83913
83913
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
83914
83914
  }
83915
83915
  checkSourceElement(node.elseStatement);
83916
83916
  }
83917
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
83917
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
83918
83918
  if (!strictNullChecks)
83919
83919
  return;
83920
83920
  helper(condExpr, body);
@@ -83929,7 +83929,7 @@ var ts;
83929
83929
  : condExpr;
83930
83930
  if (ts.isModuleExportsAccessExpression(location))
83931
83931
  return;
83932
- var type = checkTruthinessExpression(location);
83932
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
83933
83933
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
83934
83934
  if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
83935
83935
  return;
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -80054,7 +80054,7 @@ var ts;
80054
80054
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) {
80055
80055
  parent = parent.parent;
80056
80056
  }
80057
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80057
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80058
80058
  }
80059
80059
  checkTruthinessOfType(leftType, node.left);
80060
80060
  }
@@ -80565,8 +80565,8 @@ var ts;
80565
80565
  }
80566
80566
  }
80567
80567
  function checkConditionalExpression(node, checkMode) {
80568
- checkTruthinessExpression(node.condition);
80569
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
80568
+ var type = checkTruthinessExpression(node.condition);
80569
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
80570
80570
  var type1 = checkExpression(node.whenTrue, checkMode);
80571
80571
  var type2 = checkExpression(node.whenFalse, checkMode);
80572
80572
  return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */);
@@ -83906,15 +83906,15 @@ var ts;
83906
83906
  function checkIfStatement(node) {
83907
83907
  // Grammar checking
83908
83908
  checkGrammarStatementInAmbientContext(node);
83909
- checkTruthinessExpression(node.expression);
83910
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
83909
+ var type = checkTruthinessExpression(node.expression);
83910
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
83911
83911
  checkSourceElement(node.thenStatement);
83912
83912
  if (node.thenStatement.kind === 238 /* SyntaxKind.EmptyStatement */) {
83913
83913
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
83914
83914
  }
83915
83915
  checkSourceElement(node.elseStatement);
83916
83916
  }
83917
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
83917
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
83918
83918
  if (!strictNullChecks)
83919
83919
  return;
83920
83920
  helper(condExpr, body);
@@ -83929,7 +83929,7 @@ var ts;
83929
83929
  : condExpr;
83930
83930
  if (ts.isModuleExportsAccessExpression(location))
83931
83931
  return;
83932
- var type = checkTruthinessExpression(location);
83932
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
83933
83933
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
83934
83934
  if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
83935
83935
  return;
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220827");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220828");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -80044,7 +80044,7 @@ var ts;
80044
80044
  || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) {
80045
80045
  parent = parent.parent;
80046
80046
  }
80047
- checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80047
+ checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
80048
80048
  }
80049
80049
  checkTruthinessOfType(leftType, node.left);
80050
80050
  }
@@ -80555,8 +80555,8 @@ var ts;
80555
80555
  }
80556
80556
  }
80557
80557
  function checkConditionalExpression(node, checkMode) {
80558
- checkTruthinessExpression(node.condition);
80559
- checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue);
80558
+ var type = checkTruthinessExpression(node.condition);
80559
+ checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue);
80560
80560
  var type1 = checkExpression(node.whenTrue, checkMode);
80561
80561
  var type2 = checkExpression(node.whenFalse, checkMode);
80562
80562
  return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */);
@@ -83896,15 +83896,15 @@ var ts;
83896
83896
  function checkIfStatement(node) {
83897
83897
  // Grammar checking
83898
83898
  checkGrammarStatementInAmbientContext(node);
83899
- checkTruthinessExpression(node.expression);
83900
- checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement);
83899
+ var type = checkTruthinessExpression(node.expression);
83900
+ checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement);
83901
83901
  checkSourceElement(node.thenStatement);
83902
83902
  if (node.thenStatement.kind === 238 /* SyntaxKind.EmptyStatement */) {
83903
83903
  error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
83904
83904
  }
83905
83905
  checkSourceElement(node.elseStatement);
83906
83906
  }
83907
- function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) {
83907
+ function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) {
83908
83908
  if (!strictNullChecks)
83909
83909
  return;
83910
83910
  helper(condExpr, body);
@@ -83919,7 +83919,7 @@ var ts;
83919
83919
  : condExpr;
83920
83920
  if (ts.isModuleExportsAccessExpression(location))
83921
83921
  return;
83922
- var type = checkTruthinessExpression(location);
83922
+ var type = location === condExpr ? condType : checkTruthinessExpression(location);
83923
83923
  var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
83924
83924
  if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
83925
83925
  return;
@@ -430,6 +430,7 @@
430
430
  "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "类型 \"{0}\" 到类型 \"{1}\" 的转换可能是错误的,因为两种类型不能充分重叠。如果这是有意的,请先将表达式转换为 \"unknown\"。",
431
431
  "Convert_0_to_1_in_0_95003": "将“{0}”转换为 {0} 中的 {1}",
432
432
  "Convert_0_to_mapped_object_type_95055": "将“{0}”转换为映射对象类型",
433
+ "Convert_all_const_to_let_95102": "将所有 'const' 转换为 'let'",
433
434
  "Convert_all_constructor_functions_to_classes_95045": "将所有构造函数都转换为类",
434
435
  "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "将不用作值的所有导入转换为仅类型导入",
435
436
  "Convert_all_invalid_characters_to_HTML_entity_code_95101": "将所有无效字符转换为 HTML 实体代码",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.9.0-dev.20220827",
5
+ "version": "4.9.0-dev.20220828",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [