@typescript-deploys/pr-build 4.8.0-pr-49387-9 → 4.8.0-pr-49422-8

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.
@@ -23,4 +23,5 @@ and limitations under the License.
23
23
  /// <reference lib="es2022.error" />
24
24
  /// <reference lib="es2022.intl" />
25
25
  /// <reference lib="es2022.object" />
26
+ /// <reference lib="es2022.sharedmemory" />
26
27
  /// <reference lib="es2022.string" />
@@ -0,0 +1,27 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation. All rights reserved.
3
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
+ this file except in compliance with the License. You may obtain a copy of the
5
+ License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
+ MERCHANTABLITY OR NON-INFRINGEMENT.
11
+
12
+ See the Apache Version 2.0 License for specific language governing permissions
13
+ and limitations under the License.
14
+ ***************************************************************************** */
15
+
16
+
17
+
18
+ /// <reference no-default-lib="true"/>
19
+
20
+
21
+ interface Atomics {
22
+ /**
23
+ * A non-blocking, asynchronous version of wait which is usable on the main thread.
24
+ * Waits asynchronously on a shared memory location and returns a Promise
25
+ */
26
+ waitAsync(typedArray: BigInt64Array | Int32Array, index: number, value: bigint, timeout?: number): { async: false, value: "ok" | "not-equal" | "timed-out" } | { async: true, value: Promise<"ok" | "not-equal" | "timed-out"> };
27
+ }
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.8";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220604";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220607";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -31542,6 +31542,7 @@ var ts;
31542
31542
  ["es2022.error", "lib.es2022.error.d.ts"],
31543
31543
  ["es2022.intl", "lib.es2022.intl.d.ts"],
31544
31544
  ["es2022.object", "lib.es2022.object.d.ts"],
31545
+ ["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
31545
31546
  ["es2022.string", "lib.es2022.string.d.ts"],
31546
31547
  ["esnext.array", "lib.es2022.array.d.ts"],
31547
31548
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
@@ -39263,16 +39264,6 @@ var ts;
39263
39264
  var nextNodeId = 1;
39264
39265
  var nextMergeId = 1;
39265
39266
  var nextFlowId = 1;
39266
- var typeofEQFacts = new ts.Map(ts.getEntries({
39267
- string: 1,
39268
- number: 2,
39269
- bigint: 4,
39270
- boolean: 8,
39271
- symbol: 16,
39272
- undefined: 65536,
39273
- object: 32,
39274
- function: 64
39275
- }));
39276
39267
  var typeofNEFacts = new ts.Map(ts.getEntries({
39277
39268
  string: 256,
39278
39269
  number: 512,
@@ -39932,14 +39923,6 @@ var ts;
39932
39923
  var awaitedTypeStack = [];
39933
39924
  var diagnostics = ts.createDiagnosticCollection();
39934
39925
  var suggestionDiagnostics = ts.createDiagnosticCollection();
39935
- var typeofTypesByName = new ts.Map(ts.getEntries({
39936
- string: stringType,
39937
- number: numberType,
39938
- bigint: bigintType,
39939
- boolean: booleanType,
39940
- symbol: esSymbolType,
39941
- undefined: undefinedType
39942
- }));
39943
39926
  var typeofType = createTypeofType();
39944
39927
  var _jsxNamespace;
39945
39928
  var _jsxFactoryEntity;
@@ -42439,7 +42422,7 @@ var ts;
42439
42422
  return type;
42440
42423
  }
42441
42424
  function createTypeofType() {
42442
- return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getStringLiteralType));
42425
+ return getUnionType(ts.arrayFrom(typeofNEFacts.keys(), getStringLiteralType));
42443
42426
  }
42444
42427
  function createTypeParameter(symbol) {
42445
42428
  var type = createType(262144);
@@ -58293,19 +58276,15 @@ var ts;
58293
58276
  }
58294
58277
  return links.switchTypes;
58295
58278
  }
58296
- function getSwitchClauseTypeOfWitnesses(switchStatement, retainDefault) {
58279
+ function getSwitchClauseTypeOfWitnesses(switchStatement) {
58280
+ if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 && !ts.isStringLiteralLike(clause.expression); })) {
58281
+ return undefined;
58282
+ }
58297
58283
  var witnesses = [];
58298
58284
  for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
58299
58285
  var clause = _a[_i];
58300
- if (clause.kind === 289) {
58301
- if (ts.isStringLiteralLike(clause.expression)) {
58302
- witnesses.push(clause.expression.text);
58303
- continue;
58304
- }
58305
- return ts.emptyArray;
58306
- }
58307
- if (retainDefault)
58308
- witnesses.push(undefined);
58286
+ var text = clause.kind === 289 ? clause.expression.text : undefined;
58287
+ witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined);
58309
58288
  }
58310
58289
  return witnesses;
58311
58290
  }
@@ -59361,14 +59340,9 @@ var ts;
59361
59340
  }
59362
59341
  return type;
59363
59342
  }
59364
- if (type.flags & 1 && literal.text === "function") {
59365
- return type;
59366
- }
59367
- var facts = assumeTrue ?
59368
- typeofEQFacts.get(literal.text) || 128 :
59369
- typeofNEFacts.get(literal.text) || 32768;
59370
- var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
59371
- return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
59343
+ return assumeTrue ?
59344
+ narrowTypeByTypeName(type, literal.text) :
59345
+ getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768);
59372
59346
  }
59373
59347
  function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
59374
59348
  var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
@@ -59411,63 +59385,40 @@ var ts;
59411
59385
  var defaultType = filterType(type, function (t) { return !(isUnitLikeType(t) && ts.contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))); });
59412
59386
  return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]);
59413
59387
  }
59414
- function getImpliedTypeFromTypeofGuard(type, text) {
59415
- switch (text) {
59416
- case "object":
59417
- return type.flags & 1 ? type : getUnionType([nullType, nonPrimitiveType]);
59418
- case "function":
59419
- return type.flags & 1 ? type : globalFunctionType;
59420
- default:
59421
- return typeofTypesByName.get(text);
59388
+ function narrowTypeByTypeName(type, typeName) {
59389
+ switch (typeName) {
59390
+ case "string": return narrowTypeByTypeFacts(type, stringType, 1);
59391
+ case "number": return narrowTypeByTypeFacts(type, numberType, 2);
59392
+ case "bigint": return narrowTypeByTypeFacts(type, bigintType, 4);
59393
+ case "boolean": return narrowTypeByTypeFacts(type, booleanType, 8);
59394
+ case "symbol": return narrowTypeByTypeFacts(type, esSymbolType, 16);
59395
+ case "object": return type.flags & 1 ? type : getUnionType([narrowTypeByTypeFacts(type, nonPrimitiveType, 32), narrowTypeByTypeFacts(type, nullType, 131072)]);
59396
+ case "function": return type.flags & 1 ? type : narrowTypeByTypeFacts(type, globalFunctionType, 64);
59397
+ case "undefined": return narrowTypeByTypeFacts(type, undefinedType, 65536);
59422
59398
  }
59399
+ return narrowTypeByTypeFacts(type, nonPrimitiveType, 128);
59423
59400
  }
59424
- function narrowTypeByImpliedType(type, candidate) {
59425
- if (type.flags & 3) {
59426
- return candidate;
59427
- }
59401
+ function narrowTypeByTypeFacts(type, impliedType, facts) {
59428
59402
  return mapType(type, function (t) {
59429
- if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
59430
- return t;
59431
- }
59432
- return mapType(candidate, function (c) {
59433
- if (!areTypesComparable(t, c)) {
59434
- return neverType;
59435
- }
59436
- if (c.flags & 131068 && t.flags & 524288 && !isEmptyAnonymousObjectType(t)) {
59437
- return isTypeSubtypeOf(c, t) ? c : neverType;
59438
- }
59439
- if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
59440
- return c;
59441
- }
59442
- return getIntersectionType([t, c]);
59443
- });
59403
+ return isTypeSubtypeOf(impliedType, t) ? impliedType :
59404
+ !(getTypeFacts(t) & facts) ? neverType :
59405
+ isTypeRelatedTo(t, impliedType, strictSubtypeRelation) ? t :
59406
+ getIntersectionType([t, impliedType]);
59444
59407
  });
59445
59408
  }
59446
59409
  function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
59447
- var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
59448
- if (!switchWitnesses.length) {
59410
+ var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
59411
+ if (!witnesses) {
59449
59412
  return type;
59450
59413
  }
59451
- var defaultCaseLocation = ts.findIndex(switchWitnesses, function (elem) { return elem === undefined; });
59452
- var hasDefaultClause = clauseStart === clauseEnd || (defaultCaseLocation >= clauseStart && defaultCaseLocation < clauseEnd);
59453
- var clauseWitnesses;
59454
- var switchFacts;
59455
- if (defaultCaseLocation > -1) {
59456
- var witnesses = switchWitnesses.filter(function (witness) { return witness !== undefined; });
59457
- var fixedClauseStart = defaultCaseLocation < clauseStart ? clauseStart - 1 : clauseStart;
59458
- var fixedClauseEnd = defaultCaseLocation < clauseEnd ? clauseEnd - 1 : clauseEnd;
59459
- clauseWitnesses = witnesses.slice(fixedClauseStart, fixedClauseEnd);
59460
- switchFacts = getFactsFromTypeofSwitch(fixedClauseStart, fixedClauseEnd, witnesses, hasDefaultClause);
59461
- }
59462
- else {
59463
- clauseWitnesses = switchWitnesses.slice(clauseStart, clauseEnd);
59464
- switchFacts = getFactsFromTypeofSwitch(clauseStart, clauseEnd, switchWitnesses, hasDefaultClause);
59465
- }
59414
+ var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290; });
59415
+ var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd);
59466
59416
  if (hasDefaultClause) {
59467
- return filterType(type, function (t) { return (getTypeFacts(t) & switchFacts) === switchFacts; });
59417
+ var notEqualFacts_1 = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses);
59418
+ return filterType(type, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; });
59468
59419
  }
59469
- var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
59470
- return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
59420
+ var clauseWitnesses = witnesses.slice(clauseStart, clauseEnd);
59421
+ return getUnionType(ts.map(clauseWitnesses, function (text) { return text ? narrowTypeByTypeName(type, text) : neverType; }));
59471
59422
  }
59472
59423
  function isMatchingConstructorReference(expr) {
59473
59424
  return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
@@ -65255,26 +65206,11 @@ var ts;
65255
65206
  ? ts.Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
65256
65207
  : ts.Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
65257
65208
  }
65258
- function getFactsFromTypeofSwitch(start, end, witnesses, hasDefault) {
65209
+ function getNotEqualFactsFromTypeofSwitch(start, end, witnesses) {
65259
65210
  var facts = 0;
65260
- if (hasDefault) {
65261
- for (var i = end; i < witnesses.length; i++) {
65262
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65263
- }
65264
- for (var i = start; i < end; i++) {
65265
- facts &= ~(typeofNEFacts.get(witnesses[i]) || 0);
65266
- }
65267
- for (var i = 0; i < start; i++) {
65268
- facts |= typeofNEFacts.get(witnesses[i]) || 32768;
65269
- }
65270
- }
65271
- else {
65272
- for (var i = start; i < end; i++) {
65273
- facts |= typeofEQFacts.get(witnesses[i]) || 128;
65274
- }
65275
- for (var i = 0; i < start; i++) {
65276
- facts &= ~(typeofEQFacts.get(witnesses[i]) || 0);
65277
- }
65211
+ for (var i = 0; i < witnesses.length; i++) {
65212
+ var witness = i < start || i >= end ? witnesses[i] : undefined;
65213
+ facts |= witness !== undefined ? typeofNEFacts.get(witness) || 32768 : 0;
65278
65214
  }
65279
65215
  return facts;
65280
65216
  }
@@ -65284,14 +65220,16 @@ var ts;
65284
65220
  }
65285
65221
  function computeExhaustiveSwitchStatement(node) {
65286
65222
  if (node.expression.kind === 216) {
65287
- var operandType = getTypeOfExpression(node.expression.expression);
65288
- var witnesses = getSwitchClauseTypeOfWitnesses(node, false);
65289
- var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
65290
- var type_6 = getBaseConstraintOfType(operandType) || operandType;
65291
- if (type_6.flags & 3) {
65292
- return (556800 & notEqualFacts_1) === 556800;
65223
+ var witnesses = getSwitchClauseTypeOfWitnesses(node);
65224
+ if (!witnesses) {
65225
+ return false;
65293
65226
  }
65294
- return !!(filterType(type_6, function (t) { return (getTypeFacts(t) & notEqualFacts_1) === notEqualFacts_1; }).flags & 131072);
65227
+ var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
65228
+ var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
65229
+ if (operandConstraint.flags & 3) {
65230
+ return (556800 & notEqualFacts_2) === 556800;
65231
+ }
65232
+ return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
65295
65233
  }
65296
65234
  var type = getTypeOfExpression(node.expression);
65297
65235
  if (!isLiteralType(type)) {
@@ -68593,6 +68531,11 @@ var ts;
68593
68531
  function checkJSDocTypeTag(node) {
68594
68532
  checkSourceElement(node.typeExpression);
68595
68533
  }
68534
+ function checkJSDocLinkLikeTag(node) {
68535
+ if (node.name) {
68536
+ resolveJSDocMemberName(node.name, true);
68537
+ }
68538
+ }
68596
68539
  function checkJSDocParameterTag(node) {
68597
68540
  checkSourceElement(node.typeExpression);
68598
68541
  }
@@ -71842,12 +71785,16 @@ var ts;
71842
71785
  }
71843
71786
  }
71844
71787
  function checkSourceElementWorker(node) {
71845
- if (ts.isInJSFile(node)) {
71846
- ts.forEach(node.jsDoc, function (_a) {
71847
- var tags = _a.tags;
71848
- return ts.forEach(tags, checkSourceElement);
71788
+ ts.forEach(node.jsDoc, function (_a) {
71789
+ var comment = _a.comment, tags = _a.tags;
71790
+ checkJSDocCommentWorker(comment);
71791
+ ts.forEach(tags, function (tag) {
71792
+ checkJSDocCommentWorker(tag.comment);
71793
+ if (ts.isInJSFile(node)) {
71794
+ checkSourceElement(tag);
71795
+ }
71849
71796
  });
71850
- }
71797
+ });
71851
71798
  var kind = node.kind;
71852
71799
  if (cancellationToken) {
71853
71800
  switch (kind) {
@@ -71931,6 +71878,10 @@ var ts;
71931
71878
  return checkJSDocTemplateTag(node);
71932
71879
  case 343:
71933
71880
  return checkJSDocTypeTag(node);
71881
+ case 324:
71882
+ case 325:
71883
+ case 326:
71884
+ return checkJSDocLinkLikeTag(node);
71934
71885
  case 340:
71935
71886
  return checkJSDocParameterTag(node);
71936
71887
  case 347:
@@ -72024,6 +71975,15 @@ var ts;
72024
71975
  return checkMissingDeclaration(node);
72025
71976
  }
72026
71977
  }
71978
+ function checkJSDocCommentWorker(node) {
71979
+ if (ts.isArray(node)) {
71980
+ ts.forEach(node, function (tag) {
71981
+ if (ts.isJSDocLinkLike(tag)) {
71982
+ checkSourceElement(tag);
71983
+ }
71984
+ });
71985
+ }
71986
+ }
72027
71987
  function checkJSDocTypeIsInJsFile(node) {
72028
71988
  if (!ts.isInJSFile(node)) {
72029
71989
  grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
@@ -72507,7 +72467,7 @@ var ts;
72507
72467
  if (!result && isJSDoc_1) {
72508
72468
  var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
72509
72469
  if (container) {
72510
- return resolveJSDocMemberName(name, getSymbolOfNode(container));
72470
+ return resolveJSDocMemberName(name, false, getSymbolOfNode(container));
72511
72471
  }
72512
72472
  }
72513
72473
  return result;
@@ -72545,10 +72505,10 @@ var ts;
72545
72505
  }
72546
72506
  return undefined;
72547
72507
  }
72548
- function resolveJSDocMemberName(name, container) {
72508
+ function resolveJSDocMemberName(name, ignoreErrors, container) {
72549
72509
  if (ts.isEntityName(name)) {
72550
72510
  var meaning = 788968 | 1920 | 111551;
72551
- var symbol = resolveEntityName(name, meaning, false, true, ts.getHostSignatureFromJSDoc(name));
72511
+ var symbol = resolveEntityName(name, meaning, ignoreErrors, true, ts.getHostSignatureFromJSDoc(name));
72552
72512
  if (!symbol && ts.isIdentifier(name) && container) {
72553
72513
  symbol = getMergedSymbol(getSymbol(getExportsOfSymbol(container), name.escapedText, meaning));
72554
72514
  }
@@ -72556,7 +72516,7 @@ var ts;
72556
72516
  return symbol;
72557
72517
  }
72558
72518
  }
72559
- var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left);
72519
+ var left = ts.isIdentifier(name) ? container : resolveJSDocMemberName(name.left, ignoreErrors, container);
72560
72520
  var right = ts.isIdentifier(name) ? name.escapedText : name.right.escapedText;
72561
72521
  if (left) {
72562
72522
  var proto = left.flags & 111551 && getPropertyOfType(getTypeOfSymbol(left), "prototype");