@effect/language-service 0.62.0 → 0.62.2

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.
@@ -2189,6 +2189,8 @@ var nanoLayer2 = (fa) => pipe(
2189
2189
  )
2190
2190
  );
2191
2191
  function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
2192
+ const readonlyArraySymbol = typeChecker.resolveName("ReadonlyArray", void 0, ts.SymbolFlags.Type, false);
2193
+ const globalReadonlyArrayType = readonlyArraySymbol ? typeChecker.getDeclaredTypeOfSymbol(readonlyArraySymbol) : void 0;
2192
2194
  function isUnion(type) {
2193
2195
  return !!(type.flags & ts.TypeFlags.Union);
2194
2196
  }
@@ -2198,6 +2200,9 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
2198
2200
  function isThisTypeParameter(type) {
2199
2201
  return !!(type.flags & ts.TypeFlags.TypeParameter && type.isThisType);
2200
2202
  }
2203
+ function isReadonlyArrayType(type) {
2204
+ return type && "target" in type && type.target === globalReadonlyArrayType;
2205
+ }
2201
2206
  function isMissingIntrinsicType(type) {
2202
2207
  return (type.flags & ts.TypeFlags.Undefined) !== 0 && "debugIntrinsicName" in type && type.debugIntrinsicName === "missing";
2203
2208
  }
@@ -2505,6 +2510,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
2505
2510
  }
2506
2511
  return {
2507
2512
  isUnion,
2513
+ isReadonlyArrayType,
2508
2514
  isMissingIntrinsicType,
2509
2515
  getTypeParameterAtPosition,
2510
2516
  getMissingTypeEntriesInTargetType,
@@ -5778,6 +5784,7 @@ var processType = fn(
5778
5784
  if (!isSame) {
5779
5785
  const usedCount = usedGlobalIdentifiers.get(hoistName) || 0;
5780
5786
  hoistName = usedCount > 0 ? hoistName + "_" + usedCount : hoistName;
5787
+ usedGlobalIdentifiers.set(hoistName, usedCount + 1);
5781
5788
  }
5782
5789
  }
5783
5790
  }
@@ -5940,13 +5947,15 @@ var processArrayType = fn(
5940
5947
  "StructuralSchemaGen.processArrayType"
5941
5948
  )(
5942
5949
  function* (type, context) {
5943
- const { createApiCall, typeChecker } = yield* service(StructuralSchemaGenContext);
5950
+ const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
5944
5951
  const typeArgs = typeChecker.getTypeArguments(type);
5945
5952
  if (typeArgs.length === 0) {
5946
5953
  return yield* fail(new UnsupportedTypeError(type, "Array type has no type arguments"));
5947
5954
  }
5948
5955
  const elementSchema = yield* processType(typeArgs[0], context);
5949
- return [createApiCall("Array", [elementSchema]), false];
5956
+ const expr = createApiCall("Array", [elementSchema]);
5957
+ if (typeCheckerUtils.isReadonlyArrayType(type)) return [expr, false];
5958
+ return [createApiCall("mutable", [expr]), false];
5950
5959
  }
5951
5960
  );
5952
5961
  var processTupleType = fn(