@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/index.js CHANGED
@@ -4586,6 +4586,8 @@ var nanoLayer2 = (fa) => pipe(
4586
4586
  )
4587
4587
  );
4588
4588
  function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4589
+ const readonlyArraySymbol = typeChecker.resolveName("ReadonlyArray", void 0, ts.SymbolFlags.Type, false);
4590
+ const globalReadonlyArrayType = readonlyArraySymbol ? typeChecker.getDeclaredTypeOfSymbol(readonlyArraySymbol) : void 0;
4589
4591
  function isUnion(type) {
4590
4592
  return !!(type.flags & ts.TypeFlags.Union);
4591
4593
  }
@@ -4595,6 +4597,9 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4595
4597
  function isThisTypeParameter(type) {
4596
4598
  return !!(type.flags & ts.TypeFlags.TypeParameter && type.isThisType);
4597
4599
  }
4600
+ function isReadonlyArrayType(type) {
4601
+ return type && "target" in type && type.target === globalReadonlyArrayType;
4602
+ }
4598
4603
  function isMissingIntrinsicType(type) {
4599
4604
  return (type.flags & ts.TypeFlags.Undefined) !== 0 && "debugIntrinsicName" in type && type.debugIntrinsicName === "missing";
4600
4605
  }
@@ -4902,6 +4907,7 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4902
4907
  }
4903
4908
  return {
4904
4909
  isUnion,
4910
+ isReadonlyArrayType,
4905
4911
  isMissingIntrinsicType,
4906
4912
  getTypeParameterAtPosition,
4907
4913
  getMissingTypeEntriesInTargetType,
@@ -6641,6 +6647,7 @@ var processType = fn(
6641
6647
  if (!isSame) {
6642
6648
  const usedCount = usedGlobalIdentifiers.get(hoistName) || 0;
6643
6649
  hoistName = usedCount > 0 ? hoistName + "_" + usedCount : hoistName;
6650
+ usedGlobalIdentifiers.set(hoistName, usedCount + 1);
6644
6651
  }
6645
6652
  }
6646
6653
  }
@@ -6803,13 +6810,15 @@ var processArrayType = fn(
6803
6810
  "StructuralSchemaGen.processArrayType"
6804
6811
  )(
6805
6812
  function* (type, context) {
6806
- const { createApiCall, typeChecker } = yield* service(StructuralSchemaGenContext);
6813
+ const { createApiCall, typeChecker, typeCheckerUtils } = yield* service(StructuralSchemaGenContext);
6807
6814
  const typeArgs = typeChecker.getTypeArguments(type);
6808
6815
  if (typeArgs.length === 0) {
6809
6816
  return yield* fail3(new UnsupportedTypeError(type, "Array type has no type arguments"));
6810
6817
  }
6811
6818
  const elementSchema = yield* processType(typeArgs[0], context);
6812
- return [createApiCall("Array", [elementSchema]), false];
6819
+ const expr = createApiCall("Array", [elementSchema]);
6820
+ if (typeCheckerUtils.isReadonlyArrayType(type)) return [expr, false];
6821
+ return [createApiCall("mutable", [expr]), false];
6813
6822
  }
6814
6823
  );
6815
6824
  var processTupleType = fn(