@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.
package/cli.js CHANGED
@@ -31668,6 +31668,8 @@ var nanoLayer2 = (fa) => pipe(
31668
31668
  )
31669
31669
  );
31670
31670
  function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31671
+ const readonlyArraySymbol = typeChecker.resolveName("ReadonlyArray", void 0, ts.SymbolFlags.Type, false);
31672
+ const globalReadonlyArrayType = readonlyArraySymbol ? typeChecker.getDeclaredTypeOfSymbol(readonlyArraySymbol) : void 0;
31671
31673
  function isUnion4(type2) {
31672
31674
  return !!(type2.flags & ts.TypeFlags.Union);
31673
31675
  }
@@ -31677,6 +31679,9 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31677
31679
  function isThisTypeParameter(type2) {
31678
31680
  return !!(type2.flags & ts.TypeFlags.TypeParameter && type2.isThisType);
31679
31681
  }
31682
+ function isReadonlyArrayType(type2) {
31683
+ return type2 && "target" in type2 && type2.target === globalReadonlyArrayType;
31684
+ }
31680
31685
  function isMissingIntrinsicType(type2) {
31681
31686
  return (type2.flags & ts.TypeFlags.Undefined) !== 0 && "debugIntrinsicName" in type2 && type2.debugIntrinsicName === "missing";
31682
31687
  }
@@ -31984,6 +31989,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
31984
31989
  }
31985
31990
  return {
31986
31991
  isUnion: isUnion4,
31992
+ isReadonlyArrayType,
31987
31993
  isMissingIntrinsicType,
31988
31994
  getTypeParameterAtPosition,
31989
31995
  getMissingTypeEntriesInTargetType,
@@ -33642,6 +33648,7 @@ var processType = fn2(
33642
33648
  if (!isSame) {
33643
33649
  const usedCount = usedGlobalIdentifiers.get(hoistName) || 0;
33644
33650
  hoistName = usedCount > 0 ? hoistName + "_" + usedCount : hoistName;
33651
+ usedGlobalIdentifiers.set(hoistName, usedCount + 1);
33645
33652
  }
33646
33653
  }
33647
33654
  }
@@ -33804,13 +33811,15 @@ var processArrayType = fn2(
33804
33811
  "StructuralSchemaGen.processArrayType"
33805
33812
  )(
33806
33813
  function* (type2, context7) {
33807
- const { createApiCall, typeChecker } = yield* service2(StructuralSchemaGenContext);
33814
+ const { createApiCall, typeChecker, typeCheckerUtils } = yield* service2(StructuralSchemaGenContext);
33808
33815
  const typeArgs = typeChecker.getTypeArguments(type2);
33809
33816
  if (typeArgs.length === 0) {
33810
33817
  return yield* fail18(new UnsupportedTypeError(type2, "Array type has no type arguments"));
33811
33818
  }
33812
33819
  const elementSchema = yield* processType(typeArgs[0], context7);
33813
- return [createApiCall("Array", [elementSchema]), false];
33820
+ const expr = createApiCall("Array", [elementSchema]);
33821
+ if (typeCheckerUtils.isReadonlyArrayType(type2)) return [expr, false];
33822
+ return [createApiCall("mutable", [expr]), false];
33814
33823
  }
33815
33824
  );
33816
33825
  var processTupleType = fn2(