typescript 5.5.0-dev.20240515 → 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.20240515`;
21
+ var version = `${versionMajorMinor}.0-dev.20240517`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -13651,7 +13651,8 @@ function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
13651
13651
  }
13652
13652
  function getJSDocCommentRanges(node, text) {
13653
13653
  const commentRanges = node.kind === 169 /* Parameter */ || node.kind === 168 /* TypeParameter */ || node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */ || node.kind === 217 /* ParenthesizedExpression */ || node.kind === 260 /* VariableDeclaration */ || node.kind === 281 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos);
13654
- return filter(commentRanges, (comment) => text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
13654
+ return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
13655
+ text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
13655
13656
  }
13656
13657
  var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
13657
13658
  var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
@@ -50504,8 +50505,11 @@ function createTypeChecker(host) {
50504
50505
  context.flags = savedContextFlags;
50505
50506
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
50506
50507
  }
50508
+ function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
50509
+ return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
50510
+ }
50507
50511
  function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
50508
- const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
50512
+ const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
50509
50513
  return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
50510
50514
  }
50511
50515
  function typePredicateToTypePredicateNodeHelper(typePredicate, context) {
@@ -51233,7 +51237,7 @@ function createTypeChecker(host) {
51233
51237
  /*dontResolveAlias*/
51234
51238
  true
51235
51239
  );
51236
- 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 */)) {
51237
51241
  sym = getExportSymbolOfValueSymbolIfExported(sym);
51238
51242
  const symAtLocation = resolveEntityName(
51239
51243
  leftmost,
@@ -51366,6 +51370,9 @@ function createTypeChecker(host) {
51366
51370
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
51367
51371
  }
51368
51372
  function visitExistingNodeTreeSymbolsWorker(node) {
51373
+ if (isJSDocTypeExpression(node)) {
51374
+ return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
51375
+ }
51369
51376
  if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
51370
51377
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
51371
51378
  }
@@ -79299,10 +79306,7 @@ function createTypeChecker(host) {
79299
79306
  }
79300
79307
  function createAwaitedTypeIfNeeded(type) {
79301
79308
  if (isAwaitedTypeNeeded(type)) {
79302
- const awaitedType = tryCreateAwaitedType(type);
79303
- if (awaitedType) {
79304
- return awaitedType;
79305
- }
79309
+ return tryCreateAwaitedType(type) ?? type;
79306
79310
  }
79307
79311
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
79308
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.20240515`;
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";
@@ -17551,7 +17551,8 @@ function getLeadingCommentRangesOfNode(node, sourceFileOfNode) {
17551
17551
  }
17552
17552
  function getJSDocCommentRanges(node, text) {
17553
17553
  const commentRanges = node.kind === 169 /* Parameter */ || node.kind === 168 /* TypeParameter */ || node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */ || node.kind === 217 /* ParenthesizedExpression */ || node.kind === 260 /* VariableDeclaration */ || node.kind === 281 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos);
17554
- return filter(commentRanges, (comment) => text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
17554
+ return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
17555
+ text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
17555
17556
  }
17556
17557
  var fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
17557
17558
  var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)(('[^']*')|("[^"]*")).*?\/>/;
@@ -55299,8 +55300,11 @@ function createTypeChecker(host) {
55299
55300
  context.flags = savedContextFlags;
55300
55301
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
55301
55302
  }
55303
+ function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
55304
+ return typeNode && tryReuseExistingNonParameterTypeNode(context, typeNode, type) || typeToTypeNodeHelper(type, context);
55305
+ }
55302
55306
  function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
55303
- const constraintNode = constraint && typeToTypeNodeHelper(constraint, context);
55307
+ const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
55304
55308
  return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
55305
55309
  }
55306
55310
  function typePredicateToTypePredicateNodeHelper(typePredicate, context) {
@@ -56028,7 +56032,7 @@ function createTypeChecker(host) {
56028
56032
  /*dontResolveAlias*/
56029
56033
  true
56030
56034
  );
56031
- 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 */)) {
56032
56036
  sym = getExportSymbolOfValueSymbolIfExported(sym);
56033
56037
  const symAtLocation = resolveEntityName(
56034
56038
  leftmost,
@@ -56161,6 +56165,9 @@ function createTypeChecker(host) {
56161
56165
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56162
56166
  }
56163
56167
  function visitExistingNodeTreeSymbolsWorker(node) {
56168
+ if (isJSDocTypeExpression(node)) {
56169
+ return visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode);
56170
+ }
56164
56171
  if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
56165
56172
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
56166
56173
  }
@@ -84094,10 +84101,7 @@ function createTypeChecker(host) {
84094
84101
  }
84095
84102
  function createAwaitedTypeIfNeeded(type) {
84096
84103
  if (isAwaitedTypeNeeded(type)) {
84097
- const awaitedType = tryCreateAwaitedType(type);
84098
- if (awaitedType) {
84099
- return awaitedType;
84100
- }
84104
+ return tryCreateAwaitedType(type) ?? type;
84101
84105
  }
84102
84106
  Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
84103
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.20240515",
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": "4ece0a381be3d925b12b9a1626583578b8735805"
113
+ "gitHead": "79a851426c514a12a75b342e8dd2460ee6615f73"
114
114
  }