typescript 5.5.0-dev.20240516 → 5.5.0-dev.20240517

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.
@@ -27,3 +27,80 @@ interface MapConstructor {
27
27
  keySelector: (item: T, index: number) => K,
28
28
  ): Map<K, T[]>;
29
29
  }
30
+
31
+ interface ReadonlySetLike<T> {
32
+ /**
33
+ * Despite its name, returns an iterator of the values in the set-like.
34
+ */
35
+ keys(): Iterator<T>;
36
+ /**
37
+ * @returns a boolean indicating whether an element with the specified value exists in the set-like or not.
38
+ */
39
+ has(value: T): boolean;
40
+ /**
41
+ * @returns the number of (unique) elements in the set-like.
42
+ */
43
+ readonly size: number;
44
+ }
45
+
46
+ interface Set<T> {
47
+ /**
48
+ * @returns a new Set containing all the elements in this Set and also all the elements in the argument.
49
+ */
50
+ union<U>(other: ReadonlySetLike<U>): Set<T | U>;
51
+ /**
52
+ * @returns a new Set containing all the elements which are both in this Set and in the argument.
53
+ */
54
+ intersection<U>(other: ReadonlySetLike<U>): Set<T & U>;
55
+ /**
56
+ * @returns a new Set containing all the elements in this Set which are not also in the argument.
57
+ */
58
+ difference<U>(other: ReadonlySetLike<U>): Set<T>;
59
+ /**
60
+ * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both.
61
+ */
62
+ symmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U>;
63
+ /**
64
+ * @returns a boolean indicating whether all the elements in this Set are also in the argument.
65
+ */
66
+ isSubsetOf(other: ReadonlySetLike<unknown>): boolean;
67
+ /**
68
+ * @returns a boolean indicating whether all the elements in the argument are also in this Set.
69
+ */
70
+ isSupersetOf(other: ReadonlySetLike<unknown>): boolean;
71
+ /**
72
+ * @returns a boolean indicating whether this Set has no elements in common with the argument.
73
+ */
74
+ isDisjointFrom(other: ReadonlySetLike<unknown>): boolean;
75
+ }
76
+
77
+ interface ReadonlySet<T> {
78
+ /**
79
+ * @returns a new Set containing all the elements in this Set and also all the elements in the argument.
80
+ */
81
+ union<U>(other: ReadonlySetLike<U>): Set<T | U>;
82
+ /**
83
+ * @returns a new Set containing all the elements which are both in this Set and in the argument.
84
+ */
85
+ intersection<U>(other: ReadonlySetLike<U>): Set<T & U>;
86
+ /**
87
+ * @returns a new Set containing all the elements in this Set which are not also in the argument.
88
+ */
89
+ difference<U>(other: ReadonlySetLike<U>): Set<T>;
90
+ /**
91
+ * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both.
92
+ */
93
+ symmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U>;
94
+ /**
95
+ * @returns a boolean indicating whether all the elements in this Set are also in the argument.
96
+ */
97
+ isSubsetOf(other: ReadonlySetLike<unknown>): boolean;
98
+ /**
99
+ * @returns a boolean indicating whether all the elements in the argument are also in this Set.
100
+ */
101
+ isSupersetOf(other: ReadonlySetLike<unknown>): boolean;
102
+ /**
103
+ * @returns a boolean indicating whether this Set has no elements in common with the argument.
104
+ */
105
+ isDisjointFrom(other: ReadonlySetLike<unknown>): boolean;
106
+ }
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240516`;
21
+ var version = `${versionMajorMinor}.0-dev.20240517`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -50505,8 +50505,11 @@ function createTypeChecker(host) {
50505
50505
  context.flags = savedContextFlags;
50506
50506
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
50507
50507
  }
50508
+ function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
50509
+ return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
50510
+ }
50508
50511
  function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
50509
- const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
50512
+ const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
50510
50513
  return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
50511
50514
  }
50512
50515
  function typePredicateToTypePredicateNodeHelper(typePredicate, context) {
@@ -51234,7 +51237,7 @@ function createTypeChecker(host) {
51234
51237
  /*dontResolveAlias*/
51235
51238
  true
51236
51239
  );
51237
- if (context.enclosingDeclaration && (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, (n) => n === context.enclosingDeclaration)) && !(sym && sym.flags & 262144 /* TypeParameter */)) {
51240
+ if (context.enclosingDeclaration && !(sym && sym.flags & 262144 /* TypeParameter */)) {
51238
51241
  sym = getExportSymbolOfValueSymbolIfExported(sym);
51239
51242
  const symAtLocation = resolveEntityName(
51240
51243
  leftmost,
@@ -51367,6 +51370,9 @@ function createTypeChecker(host) {
51367
51370
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
51368
51371
  }
51369
51372
  function visitExistingNodeTreeSymbolsWorker(node) {
51373
+ if (isJSDocTypeExpression(node)) {
51374
+ return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
51375
+ }
51370
51376
  if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
51371
51377
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
51372
51378
  }
@@ -79300,10 +79306,7 @@ function createTypeChecker(host) {
79300
79306
  }
79301
79307
  function createAwaitedTypeIfNeeded(type) {
79302
79308
  if (isAwaitedTypeNeeded(type)) {
79303
- const awaitedType = tryCreateAwaitedType(type);
79304
- if (awaitedType) {
79305
- return awaitedType;
79306
- }
79309
+ return tryCreateAwaitedType(type) ?? type;
79307
79310
  }
79308
79311
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
79309
79312
  return type;
package/lib/typescript.js CHANGED
@@ -2368,7 +2368,7 @@ module.exports = __toCommonJS(typescript_exports);
2368
2368
 
2369
2369
  // src/compiler/corePublic.ts
2370
2370
  var versionMajorMinor = "5.5";
2371
- var version = `${versionMajorMinor}.0-dev.20240516`;
2371
+ var version = `${versionMajorMinor}.0-dev.20240517`;
2372
2372
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2373
2373
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2374
2374
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -55300,8 +55300,11 @@ function createTypeChecker(host) {
55300
55300
  context.flags = savedContextFlags;
55301
55301
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
55302
55302
  }
55303
+ function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
55304
+ return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
55305
+ }
55303
55306
  function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
55304
- const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
55307
+ const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
55305
55308
  return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
55306
55309
  }
55307
55310
  function typePredicateToTypePredicateNodeHelper(typePredicate, context) {
@@ -56029,7 +56032,7 @@ function createTypeChecker(host) {
56029
56032
  /*dontResolveAlias*/
56030
56033
  true
56031
56034
  );
56032
- if (context.enclosingDeclaration && (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, (n) => n === context.enclosingDeclaration)) && !(sym && sym.flags & 262144 /* TypeParameter */)) {
56035
+ if (context.enclosingDeclaration && !(sym && sym.flags & 262144 /* TypeParameter */)) {
56033
56036
  sym = getExportSymbolOfValueSymbolIfExported(sym);
56034
56037
  const symAtLocation = resolveEntityName(
56035
56038
  leftmost,
@@ -56162,6 +56165,9 @@ function createTypeChecker(host) {
56162
56165
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56163
56166
  }
56164
56167
  function visitExistingNodeTreeSymbolsWorker(node) {
56168
+ if (isJSDocTypeExpression(node)) {
56169
+ return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
56170
+ }
56165
56171
  if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
56166
56172
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
56167
56173
  }
@@ -84095,10 +84101,7 @@ function createTypeChecker(host) {
84095
84101
  }
84096
84102
  function createAwaitedTypeIfNeeded(type) {
84097
84103
  if (isAwaitedTypeNeeded(type)) {
84098
- const awaitedType = tryCreateAwaitedType(type);
84099
- if (awaitedType) {
84100
- return awaitedType;
84101
- }
84104
+ return tryCreateAwaitedType(type) ?? type;
84102
84105
  }
84103
84106
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
84104
84107
  return type;
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": "5.5.0-dev.20240516",
5
+ "version": "5.5.0-dev.20240517",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "5c21b7fd93cc60b05d560f931fb8bb26d7972f76"
113
+ "gitHead": "79a851426c514a12a75b342e8dd2460ee6615f73"
114
114
  }