@effect/language-service 0.62.5 → 0.63.0

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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Function.js
3
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Function.js
4
4
  var isFunction = (input) => typeof input === "function";
5
5
  var dual = function(arity, body) {
6
6
  if (typeof arity === "function") {
@@ -98,7 +98,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
98
98
  }
99
99
  }
100
100
 
101
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Equivalence.js
101
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Equivalence.js
102
102
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
103
103
  var array = (item) => make((self, that) => {
104
104
  if (self.length !== that.length) {
@@ -113,7 +113,7 @@ var array = (item) => make((self, that) => {
113
113
  return true;
114
114
  });
115
115
 
116
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/GlobalValue.js
116
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/GlobalValue.js
117
117
  var globalStoreId = `effect/GlobalValue`;
118
118
  var globalStore;
119
119
  var globalValue = (id, compute) => {
@@ -127,7 +127,7 @@ var globalValue = (id, compute) => {
127
127
  return globalStore.get(id);
128
128
  };
129
129
 
130
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Predicate.js
130
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Predicate.js
131
131
  var isString = (input) => typeof input === "string";
132
132
  var isNumber = (input) => typeof input === "number";
133
133
  var isBoolean = (input) => typeof input === "boolean";
@@ -138,10 +138,10 @@ var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) &&
138
138
  var isTagged = /* @__PURE__ */ dual(2, (self, tag) => hasProperty(self, "_tag") && self["_tag"] === tag);
139
139
  var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
140
140
 
141
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/errors.js
141
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/errors.js
142
142
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
143
143
 
144
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Utils.js
144
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Utils.js
145
145
  var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
146
146
  var GenKindImpl = class {
147
147
  value;
@@ -263,7 +263,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
263
263
  var genConstructor = function* () {
264
264
  }.constructor;
265
265
 
266
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Hash.js
266
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Hash.js
267
267
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
268
268
  var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
269
269
  var hash = (self) => {
@@ -288,6 +288,9 @@ var hash = (self) => {
288
288
  if (self === null) {
289
289
  return string("null");
290
290
  } else if (self instanceof Date) {
291
+ if (Number.isNaN(self.getTime())) {
292
+ return string("Invalid Date");
293
+ }
291
294
  return hash(self.toISOString());
292
295
  } else if (self instanceof URL) {
293
296
  return hash(self.href);
@@ -369,7 +372,7 @@ var cached = function() {
369
372
  return hash2;
370
373
  };
371
374
 
372
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Equal.js
375
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Equal.js
373
376
  var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
374
377
  function equals() {
375
378
  if (arguments.length === 1) {
@@ -394,7 +397,9 @@ function compareBoth(self, that) {
394
397
  return structuralRegionState.enabled && structuralRegionState.tester ? structuralRegionState.tester(self, that) : false;
395
398
  }
396
399
  } else if (self instanceof Date && that instanceof Date) {
397
- return self.toISOString() === that.toISOString();
400
+ const t1 = self.getTime();
401
+ const t2 = that.getTime();
402
+ return t1 === t2 || Number.isNaN(t1) && Number.isNaN(t2);
398
403
  } else if (self instanceof URL && that instanceof URL) {
399
404
  return self.href === that.href;
400
405
  }
@@ -423,7 +428,7 @@ function compareBoth(self, that) {
423
428
  var isEqual = (u) => hasProperty(u, symbol2);
424
429
  var equivalence = () => equals;
425
430
 
426
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Inspectable.js
431
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Inspectable.js
427
432
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
428
433
  var toJSON = (x) => {
429
434
  try {
@@ -481,7 +486,7 @@ var redact = (u) => {
481
486
  return u;
482
487
  };
483
488
 
484
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Pipeable.js
489
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Pipeable.js
485
490
  var pipeArguments = (self, args2) => {
486
491
  switch (args2.length) {
487
492
  case 0:
@@ -514,16 +519,16 @@ var pipeArguments = (self, args2) => {
514
519
  }
515
520
  };
516
521
 
517
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/opCodes/effect.js
522
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/opCodes/effect.js
518
523
  var OP_COMMIT = "Commit";
519
524
  var OP_FAILURE = "Failure";
520
525
  var OP_WITH_RUNTIME = "WithRuntime";
521
526
 
522
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/version.js
523
- var moduleVersion = "3.19.0";
527
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/version.js
528
+ var moduleVersion = "3.19.13";
524
529
  var getCurrentVersion = () => moduleVersion;
525
530
 
526
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/effectable.js
531
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/effectable.js
527
532
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
528
533
  var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
529
534
  var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -610,7 +615,7 @@ var StructuralCommitPrototype = {
610
615
  ...StructuralPrototype
611
616
  };
612
617
 
613
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/option.js
618
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/option.js
614
619
  var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
615
620
  var CommonProto = {
616
621
  ...EffectPrototype,
@@ -668,7 +673,7 @@ var some = (value) => {
668
673
  return a;
669
674
  };
670
675
 
671
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/either.js
676
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/either.js
672
677
  var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
673
678
  var CommonProto2 = {
674
679
  ...EffectPrototype,
@@ -730,7 +735,7 @@ var right = (right3) => {
730
735
  return a;
731
736
  };
732
737
 
733
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Either.js
738
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Either.js
734
739
  var right2 = right;
735
740
  var left2 = left;
736
741
  var isLeft2 = isLeft;
@@ -738,17 +743,17 @@ var isRight2 = isRight;
738
743
  var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
739
744
  var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
740
745
 
741
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/array.js
746
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/array.js
742
747
  var isNonEmptyArray = (self) => self.length > 0;
743
748
 
744
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Order.js
749
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Order.js
745
750
  var make2 = (compare) => (self, that) => self === that ? 0 : compare(self, that);
746
751
  var string2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
747
752
  var number2 = /* @__PURE__ */ make2((self, that) => self < that ? -1 : 1);
748
753
  var reverse = (O) => make2((self, that) => O(that, self));
749
754
  var mapInput = /* @__PURE__ */ dual(2, (self, f) => make2((b1, b2) => self(f(b1), f(b2))));
750
755
 
751
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Option.js
756
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Option.js
752
757
  var none2 = () => none;
753
758
  var some2 = some;
754
759
  var isNone2 = isNone;
@@ -759,7 +764,7 @@ var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nu
759
764
  var getOrUndefined = /* @__PURE__ */ getOrElse2(constUndefined);
760
765
  var map2 = /* @__PURE__ */ dual(2, (self, f) => isNone2(self) ? none2() : some2(f(self.value)));
761
766
 
762
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Record.js
767
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Record.js
763
768
  var map3 = /* @__PURE__ */ dual(2, (self, f) => {
764
769
  const out = {
765
770
  ...self
@@ -771,7 +776,7 @@ var map3 = /* @__PURE__ */ dual(2, (self, f) => {
771
776
  });
772
777
  var keys = (self) => Object.keys(self);
773
778
 
774
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Array.js
779
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Array.js
775
780
  var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
776
781
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
777
782
  var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
@@ -811,7 +816,10 @@ var containsWith = (isEquivalent) => dual(2, (self, a) => {
811
816
  var _equivalence = /* @__PURE__ */ equivalence();
812
817
  var intersectionWith = (isEquivalent) => {
813
818
  const has3 = containsWith(isEquivalent);
814
- return dual(2, (self, that) => fromIterable(self).filter((a) => has3(that, a)));
819
+ return dual(2, (self, that) => {
820
+ const bs = fromIterable(that);
821
+ return fromIterable(self).filter((a) => has3(bs, a));
822
+ });
815
823
  };
816
824
  var intersection = /* @__PURE__ */ intersectionWith(_equivalence);
817
825
  var empty = () => [];
@@ -872,7 +880,7 @@ var dedupeWith = /* @__PURE__ */ dual(2, (self, isEquivalent) => {
872
880
  var dedupe = (self) => dedupeWith(self, equivalence());
873
881
  var join = /* @__PURE__ */ dual(2, (self, sep) => fromIterable(self).join(sep));
874
882
 
875
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Chunk.js
883
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Chunk.js
876
884
  var TypeId3 = /* @__PURE__ */ Symbol.for("effect/Chunk");
877
885
  function copy(src, srcPos, dest, destPos, len) {
878
886
  for (let i = srcPos; i < Math.min(src.length, srcPos + len); i++) {
@@ -1168,14 +1176,14 @@ var isNonEmpty = (self) => self.length > 0;
1168
1176
  var unsafeHead = (self) => unsafeGet2(self, 0);
1169
1177
  var headNonEmpty2 = unsafeHead;
1170
1178
 
1171
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashMap/config.js
1179
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashMap/config.js
1172
1180
  var SIZE = 5;
1173
1181
  var BUCKET_SIZE = /* @__PURE__ */ Math.pow(2, SIZE);
1174
1182
  var MASK = BUCKET_SIZE - 1;
1175
1183
  var MAX_INDEX_NODE = BUCKET_SIZE / 2;
1176
1184
  var MIN_ARRAY_NODE = BUCKET_SIZE / 4;
1177
1185
 
1178
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
1186
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashMap/bitwise.js
1179
1187
  function popcount(x) {
1180
1188
  x -= x >> 1 & 1431655765;
1181
1189
  x = (x & 858993459) + (x >> 2 & 858993459);
@@ -1194,13 +1202,13 @@ function fromBitmap(bitmap, bit) {
1194
1202
  return popcount(bitmap & bit - 1);
1195
1203
  }
1196
1204
 
1197
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/stack.js
1205
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/stack.js
1198
1206
  var make4 = (value, previous) => ({
1199
1207
  value,
1200
1208
  previous
1201
1209
  });
1202
1210
 
1203
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashMap/array.js
1211
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashMap/array.js
1204
1212
  function arrayUpdate(mutate3, at, v, arr) {
1205
1213
  let out = arr;
1206
1214
  if (!mutate3) {
@@ -1245,7 +1253,7 @@ function arraySpliceIn(mutate3, at, v, arr) {
1245
1253
  return out;
1246
1254
  }
1247
1255
 
1248
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashMap/node.js
1256
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashMap/node.js
1249
1257
  var EmptyNode = class _EmptyNode {
1250
1258
  _tag = "EmptyNode";
1251
1259
  modify(edit, _shift, f, hash2, key, size4) {
@@ -1480,7 +1488,7 @@ function mergeLeaves(edit, shift, h1, n1, h2, n2) {
1480
1488
  }
1481
1489
  }
1482
1490
 
1483
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashMap.js
1491
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashMap.js
1484
1492
  var HashMapSymbolKey = "effect/HashMap";
1485
1493
  var HashMapTypeId = /* @__PURE__ */ Symbol.for(HashMapSymbolKey);
1486
1494
  var HashMapProto = {
@@ -1692,7 +1700,7 @@ var reduce2 = /* @__PURE__ */ dual(3, (self, zero2, f) => {
1692
1700
  return zero2;
1693
1701
  });
1694
1702
 
1695
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/hashSet.js
1703
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/hashSet.js
1696
1704
  var HashSetSymbolKey = "effect/HashSet";
1697
1705
  var HashSetTypeId = /* @__PURE__ */ Symbol.for(HashSetSymbolKey);
1698
1706
  var HashSetProto = {
@@ -1754,13 +1762,13 @@ var union2 = /* @__PURE__ */ dual(2, (self, that) => mutate(empty4(), (set2) =>
1754
1762
  }));
1755
1763
  var forEach2 = /* @__PURE__ */ dual(2, (self, f) => forEach(self._keyMap, (_, k) => f(k)));
1756
1764
 
1757
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/HashSet.js
1765
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/HashSet.js
1758
1766
  var empty5 = empty4;
1759
1767
  var size3 = size2;
1760
1768
  var add2 = add;
1761
1769
  var union3 = union2;
1762
1770
 
1763
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/data.js
1771
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/data.js
1764
1772
  var ArrayProto = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Array.prototype), {
1765
1773
  [symbol]() {
1766
1774
  return cached(this, array2(this));
@@ -1783,7 +1791,7 @@ var Structural = /* @__PURE__ */ (function() {
1783
1791
  return Structural2;
1784
1792
  })();
1785
1793
 
1786
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/opCodes/cause.js
1794
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/opCodes/cause.js
1787
1795
  var OP_DIE = "Die";
1788
1796
  var OP_EMPTY = "Empty";
1789
1797
  var OP_FAIL = "Fail";
@@ -1791,7 +1799,7 @@ var OP_INTERRUPT = "Interrupt";
1791
1799
  var OP_PARALLEL = "Parallel";
1792
1800
  var OP_SEQUENTIAL = "Sequential";
1793
1801
 
1794
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/cause.js
1802
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/cause.js
1795
1803
  var CauseSymbolKey = "effect/Cause";
1796
1804
  var CauseTypeId = /* @__PURE__ */ Symbol.for(CauseSymbolKey);
1797
1805
  var variance = {
@@ -2223,7 +2231,7 @@ var prettyErrors = (cause) => reduceWithContext(cause, void 0, {
2223
2231
  sequentialCase: (_, l, r) => [...l, ...r]
2224
2232
  });
2225
2233
 
2226
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/singleShotGen.js
2234
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/singleShotGen.js
2227
2235
  var SingleShotGen2 = class _SingleShotGen {
2228
2236
  self;
2229
2237
  called = false;
@@ -2253,7 +2261,7 @@ var SingleShotGen2 = class _SingleShotGen {
2253
2261
  }
2254
2262
  };
2255
2263
 
2256
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/core.js
2264
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/core.js
2257
2265
  var EffectTypeId2 = /* @__PURE__ */ Symbol.for("effect/Effect");
2258
2266
  var EffectPrimitive = class {
2259
2267
  _op;
@@ -2537,7 +2545,7 @@ var currentSpanFromFiber = (fiber) => {
2537
2545
  return span !== void 0 && span._tag === "Span" ? some2(span) : none2();
2538
2546
  };
2539
2547
 
2540
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Data.js
2548
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Data.js
2541
2549
  var Class2 = Structural;
2542
2550
  var Error2 = /* @__PURE__ */ (function() {
2543
2551
  const plainArgsSymbol = /* @__PURE__ */ Symbol.for("effect/Data/Error/plainArgs");
@@ -2575,10 +2583,10 @@ var TaggedError = (tag) => {
2575
2583
  return O.BaseEffectError;
2576
2584
  };
2577
2585
 
2578
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/encoding/common.js
2586
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/encoding/common.js
2579
2587
  var encoder = /* @__PURE__ */ new TextEncoder();
2580
2588
 
2581
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/encoding/base64.js
2589
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/encoding/base64.js
2582
2590
  var encode = (bytes) => {
2583
2591
  const length = bytes.length;
2584
2592
  let result = "";
@@ -2604,13 +2612,13 @@ var encode = (bytes) => {
2604
2612
  };
2605
2613
  var base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"];
2606
2614
 
2607
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/internal/encoding/base64Url.js
2615
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/internal/encoding/base64Url.js
2608
2616
  var encode2 = (data) => encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
2609
2617
 
2610
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Encoding.js
2618
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Encoding.js
2611
2619
  var encodeBase64Url = (input) => typeof input === "string" ? encode2(encoder.encode(input)) : encode2(input);
2612
2620
 
2613
- // node_modules/.pnpm/effect@3.19.0/node_modules/effect/dist/esm/Graph.js
2621
+ // node_modules/.pnpm/effect@3.19.13/node_modules/effect/dist/esm/Graph.js
2614
2622
  var TypeId4 = "~effect/Graph";
2615
2623
  var Edge = class extends Class2 {
2616
2624
  };
@@ -3118,12 +3126,12 @@ var SingleShotGen3 = class _SingleShotGen {
3118
3126
  return new _SingleShotGen(this.self);
3119
3127
  }
3120
3128
  };
3121
- var evaluate = Symbol.for("Nano.evaluate");
3122
- var contA = Symbol.for("Nano.contA");
3123
- var contE = Symbol.for("Nano.contE");
3124
- var contAll = Symbol.for("Nano.contAll");
3125
- var NanoYield = Symbol.for("Nano.yield");
3126
- var args = Symbol.for("Nano.args");
3129
+ var evaluate = /* @__PURE__ */ Symbol.for("Nano.evaluate");
3130
+ var contA = /* @__PURE__ */ Symbol.for("Nano.contA");
3131
+ var contE = /* @__PURE__ */ Symbol.for("Nano.contE");
3132
+ var contAll = /* @__PURE__ */ Symbol.for("Nano.contAll");
3133
+ var NanoYield = /* @__PURE__ */ Symbol.for("Nano.yield");
3134
+ var args = /* @__PURE__ */ Symbol.for("Nano.args");
3127
3135
  var NanoDefectException = class {
3128
3136
  constructor(message, lastSpan) {
3129
3137
  this.message = message;
@@ -4527,6 +4535,8 @@ var nanoLayer2 = (fa) => pipe(
4527
4535
  function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4528
4536
  const readonlyArraySymbol = typeChecker.resolveName("ReadonlyArray", void 0, ts.SymbolFlags.Type, false);
4529
4537
  const globalReadonlyArrayType = readonlyArraySymbol ? typeChecker.getDeclaredTypeOfSymbol(readonlyArraySymbol) : void 0;
4538
+ const errorSymbol = typeChecker.resolveName("Error", void 0, ts.SymbolFlags.Type, false);
4539
+ const globalErrorType = errorSymbol ? typeChecker.getDeclaredTypeOfSymbol(errorSymbol) : void 0;
4530
4540
  function isUnion(type) {
4531
4541
  return !!(type.flags & ts.TypeFlags.Union);
4532
4542
  }
@@ -4775,6 +4785,10 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4775
4785
  function typeToSimplifiedTypeNode(type, enclosingNode, flags) {
4776
4786
  return typeToSimplifiedTypeNodeWorker(type, enclosingNode, flags, 0);
4777
4787
  }
4788
+ function isGlobalErrorType(type) {
4789
+ if (!globalErrorType) return false;
4790
+ return typeChecker.isTypeAssignableTo(type, globalErrorType) && typeChecker.isTypeAssignableTo(globalErrorType, type);
4791
+ }
4778
4792
  function typeToSimplifiedTypeNodeWorker(type, enclosingNode, flags, depth) {
4779
4793
  const fallbackStandard = () => {
4780
4794
  const typeNode = typeChecker.typeToTypeNode(type, enclosingNode, flags);
@@ -4844,6 +4858,15 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4844
4858
  }
4845
4859
  return fallbackStandard();
4846
4860
  }
4861
+ function getTypeAtLocation(node) {
4862
+ if (node.parent && ts.isJsxSelfClosingElement(node.parent) && node.parent.tagName === node) return;
4863
+ if (node.parent && ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node) return;
4864
+ if (node.parent && ts.isJsxClosingElement(node.parent) && node.parent.tagName === node) return;
4865
+ if (node.parent && ts.isJsxAttribute(node.parent) && node.parent.name === node) return;
4866
+ if (ts.isExpression(node) || ts.isTypeNode(node)) {
4867
+ return typeChecker.getTypeAtLocation(node);
4868
+ }
4869
+ }
4847
4870
  return {
4848
4871
  isUnion,
4849
4872
  isReadonlyArrayType,
@@ -4855,7 +4878,9 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
4855
4878
  deterministicTypeOrder,
4856
4879
  getInferredReturnType,
4857
4880
  expectedAndRealType,
4858
- typeToSimplifiedTypeNode
4881
+ typeToSimplifiedTypeNode,
4882
+ isGlobalErrorType,
4883
+ getTypeAtLocation
4859
4884
  };
4860
4885
  }
4861
4886
 
@@ -4977,7 +5002,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4977
5002
  return isSymbolExportOfPackageModule(symbol3, packageName, memberName, isCorrectSourceFile);
4978
5003
  };
4979
5004
  const findSymbolsMatchingPackageAndExportedName = (packageName, exportedSymbolName) => cachedBy(
4980
- fn("TypeParser.findSymbolsMatchingPackageAndExportedName")(function* (_fromSourceFile) {
5005
+ fn("TypeParser.findSymbolsMatchingPackageAndExportedName")(function* () {
4981
5006
  const result = [];
4982
5007
  for (const sourceFile of program.getSourceFiles()) {
4983
5008
  const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
@@ -4991,7 +5016,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4991
5016
  return result;
4992
5017
  }),
4993
5018
  `TypeParser.findSymbolsMatchingPackageAndExportedName(${packageName}, ${exportedSymbolName})`,
4994
- (sourceFile) => sourceFile
5019
+ () => program
4995
5020
  );
4996
5021
  const isCauseTypeSourceFile = cachedBy(
4997
5022
  fn("TypeParser.isCauseTypeSourceFile")(function* (sourceFile) {
@@ -5006,20 +5031,22 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5006
5031
  "TypeParser.isCauseTypeSourceFile",
5007
5032
  (sourceFile) => sourceFile
5008
5033
  );
5009
- const effectCauseYieldableErrorTypes = cachedBy(
5010
- fn("TypeParser.effectCauseYieldableErrorTypes")(function* (fromSourceFile) {
5011
- const symbols = yield* findSymbolsMatchingPackageAndExportedName("effect", "YieldableError")(fromSourceFile);
5012
- const result = [];
5034
+ const extendsCauseYieldableError = cachedBy(
5035
+ fn("TypeParser.extendsCauseYieldableError")(function* (givenType) {
5036
+ const symbols = yield* findSymbolsMatchingPackageAndExportedName("effect", "YieldableError")();
5013
5037
  for (const [symbol3, sourceFile] of symbols) {
5014
- const causeFile = yield* isCauseTypeSourceFile(sourceFile);
5038
+ const causeFile = yield* pipe(isCauseTypeSourceFile(sourceFile), orElse2(() => void_));
5015
5039
  if (!causeFile) continue;
5016
5040
  const type = typeChecker.getDeclaredTypeOfSymbol(symbol3);
5017
- result.push(type);
5041
+ if (!type) continue;
5042
+ if (typeChecker.isTypeAssignableTo(givenType, type)) {
5043
+ return type;
5044
+ }
5018
5045
  }
5019
- return result;
5046
+ return yield* typeParserIssue("Type does not extend Cause.YieldableError", givenType);
5020
5047
  }),
5021
- "TypeParser.effectCauseYieldableErrorTypes",
5022
- (fromSourceFile) => fromSourceFile
5048
+ "TypeParser.extendsCauseYieldableError",
5049
+ (type) => type
5023
5050
  );
5024
5051
  function covariantTypeArgument(type) {
5025
5052
  const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
@@ -5409,7 +5436,8 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
5409
5436
  }
5410
5437
  if (ts.isYieldExpression(nodeToCheck) && nodeToCheck.asteriskToken && nodeToCheck.expression) {
5411
5438
  const yieldedExpression = nodeToCheck.expression;
5412
- const type = typeChecker.getTypeAtLocation(yieldedExpression);
5439
+ const type = typeCheckerUtils.getTypeAtLocation(yieldedExpression);
5440
+ if (!type) continue;
5413
5441
  const { A: successType } = yield* effectType(type, yieldedExpression);
5414
5442
  let replacementNode = succeed(yieldedExpression);
5415
5443
  if (!explicitReturn && !(successType.flags & ts.TypeFlags.VoidLike)) {
@@ -6000,11 +6028,79 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6000
6028
  "TypeParser.extendsEffectService",
6001
6029
  (atLocation) => atLocation
6002
6030
  );
6031
+ const isEffectSqlModelTypeSourceFile = cachedBy(
6032
+ fn("TypeParser.isEffectSqlModelTypeSourceFile")(function* (sourceFile) {
6033
+ const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
6034
+ if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
6035
+ const classSymbol = typeChecker.tryGetMemberInModuleExports("Class", moduleSymbol);
6036
+ if (!classSymbol) return yield* typeParserIssue("Model's Class type not found", void 0, sourceFile);
6037
+ const makeRepositorySymbol = typeChecker.tryGetMemberInModuleExports("makeRepository", moduleSymbol);
6038
+ if (!makeRepositorySymbol) {
6039
+ return yield* typeParserIssue("Model's makeRepository type not found", void 0, sourceFile);
6040
+ }
6041
+ const makeDataLoadersSymbol = typeChecker.tryGetMemberInModuleExports("makeDataLoaders", moduleSymbol);
6042
+ if (!makeDataLoadersSymbol) {
6043
+ return yield* typeParserIssue("Model's makeDataLoaders type not found", void 0, sourceFile);
6044
+ }
6045
+ return sourceFile;
6046
+ }),
6047
+ "TypeParser.isEffectSqlModelTypeSourceFile",
6048
+ (sourceFile) => sourceFile
6049
+ );
6050
+ const isNodeReferenceToEffectSqlModelModuleApi = (memberName) => cachedBy(
6051
+ fn("TypeParser.isNodeReferenceToEffectSqlModelModuleApi")(function* (node) {
6052
+ return yield* isNodeReferenceToExportOfPackageModule(
6053
+ node,
6054
+ "@effect/sql",
6055
+ isEffectSqlModelTypeSourceFile,
6056
+ memberName
6057
+ );
6058
+ }),
6059
+ `TypeParser.isNodeReferenceToEffectSqlModelModuleApi(${memberName})`,
6060
+ (node) => node
6061
+ );
6062
+ const extendsEffectSqlModelClass = cachedBy(
6063
+ fn("TypeParser.extendsEffectSqlModelClass")(function* (atLocation) {
6064
+ if (!atLocation.name) {
6065
+ return yield* typeParserIssue("Class has no name", void 0, atLocation);
6066
+ }
6067
+ const heritageClauses = atLocation.heritageClauses;
6068
+ if (!heritageClauses) {
6069
+ return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
6070
+ }
6071
+ for (const heritageClause of heritageClauses) {
6072
+ for (const typeX of heritageClause.types) {
6073
+ if (ts.isExpressionWithTypeArguments(typeX)) {
6074
+ const expression = typeX.expression;
6075
+ if (ts.isCallExpression(expression)) {
6076
+ const schemaCall = expression.expression;
6077
+ if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
6078
+ const isEffectSchemaModuleApi = yield* pipe(
6079
+ isNodeReferenceToEffectSqlModelModuleApi("Class")(schemaCall.expression),
6080
+ option
6081
+ );
6082
+ if (isSome2(isEffectSchemaModuleApi)) {
6083
+ return {
6084
+ className: atLocation.name,
6085
+ selfTypeNode: schemaCall.typeArguments[0]
6086
+ };
6087
+ }
6088
+ }
6089
+ }
6090
+ }
6091
+ }
6092
+ }
6093
+ return yield* typeParserIssue("Class does not extend @effect/sql's Model.Class", void 0, atLocation);
6094
+ }),
6095
+ "TypeParser.extendsEffectSqlModelClass",
6096
+ (atLocation) => atLocation
6097
+ );
6003
6098
  return {
6004
6099
  isNodeReferenceToEffectModuleApi,
6005
6100
  isNodeReferenceToEffectSchemaModuleApi,
6006
6101
  isNodeReferenceToEffectDataModuleApi,
6007
6102
  isNodeReferenceToEffectContextModuleApi,
6103
+ isNodeReferenceToEffectSqlModelModuleApi,
6008
6104
  effectType,
6009
6105
  strictEffectType,
6010
6106
  layerType,
@@ -6014,7 +6110,7 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6014
6110
  effectGen,
6015
6111
  effectFnUntracedGen,
6016
6112
  effectFnGen,
6017
- effectCauseYieldableErrorTypes,
6113
+ extendsCauseYieldableError,
6018
6114
  unnecessaryEffectGen: unnecessaryEffectGen2,
6019
6115
  effectSchemaType,
6020
6116
  contextTag,
@@ -6030,7 +6126,8 @@ function make7(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
6030
6126
  extendsSchemaTaggedError,
6031
6127
  extendsDataTaggedError,
6032
6128
  extendsDataTaggedClass,
6033
- extendsSchemaTaggedRequest
6129
+ extendsSchemaTaggedRequest,
6130
+ extendsEffectSqlModelClass
6034
6131
  };
6035
6132
  }
6036
6133
 
@@ -6429,7 +6526,8 @@ var annotate = createCodegen({
6429
6526
  }
6430
6527
  for (const variableDeclaration of variableDeclarations) {
6431
6528
  if (!variableDeclaration.initializer) continue;
6432
- const initializerType = typeChecker.getTypeAtLocation(variableDeclaration.initializer);
6529
+ const initializerType = typeCheckerUtils.getTypeAtLocation(variableDeclaration.initializer);
6530
+ if (!initializerType) continue;
6433
6531
  const enclosingNode = ts.findAncestor(variableDeclaration, (_) => tsUtils.isDeclarationKind(_.kind)) || sourceFile;
6434
6532
  const initializerTypeNode = fromNullable(typeCheckerUtils.typeToSimplifiedTypeNode(
6435
6533
  initializerType,
@@ -6881,7 +6979,7 @@ var findNodeToProcess = fn("StructuralSchemaGen.findNodeToProcess")(
6881
6979
  function* (sourceFile, textRange) {
6882
6980
  const ts = yield* service(TypeScriptApi);
6883
6981
  const tsUtils = yield* service(TypeScriptUtils);
6884
- const typeChecker = yield* service(TypeCheckerApi);
6982
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
6885
6983
  return pipe(
6886
6984
  tsUtils.getAncestorNodesInRange(sourceFile, textRange),
6887
6985
  filter((node) => ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node)),
@@ -6890,7 +6988,7 @@ var findNodeToProcess = fn("StructuralSchemaGen.findNodeToProcess")(
6890
6988
  map4((node) => ({
6891
6989
  node,
6892
6990
  identifier: node.name,
6893
- type: typeChecker.getTypeAtLocation(node.name),
6991
+ type: typeCheckerUtils.getTypeAtLocation(node.name),
6894
6992
  isExported: node.modifiers ? (ts.getCombinedModifierFlags(node) & ts.ModifierFlags.Export) !== 0 : false
6895
6993
  })),
6896
6994
  filter(({ type }) => !!type),
@@ -7068,7 +7166,7 @@ var typeToSchema = createCodegen({
7068
7166
  )
7069
7167
  );
7070
7168
  }
7071
- const type = typeChecker.getTypeAtLocation(node.name);
7169
+ const type = typeCheckerUtils.getTypeAtLocation(node.name);
7072
7170
  if (!type) {
7073
7171
  return yield* fail3(
7074
7172
  new CodegenNotApplicableError(
@@ -7229,10 +7327,12 @@ var effectDataClasses = createCompletion({
7229
7327
  var anyUnknownInErrorContext = createDiagnostic({
7230
7328
  name: "anyUnknownInErrorContext",
7231
7329
  code: 28,
7330
+ description: "Detects 'any' or 'unknown' types in Effect error or requirements channels",
7232
7331
  severity: "off",
7233
7332
  apply: fn("anyUnknownInErrorContext.apply")(function* (sourceFile, report) {
7234
7333
  const ts = yield* service(TypeScriptApi);
7235
7334
  const typeChecker = yield* service(TypeCheckerApi);
7335
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
7236
7336
  const typeParser = yield* service(TypeParser);
7237
7337
  const isAnyOrUnknown = (type) => (type.flags & ts.TypeFlags.Any) > 0 || (type.flags & ts.TypeFlags.Unknown) > 0;
7238
7338
  const matchingNodes = [];
@@ -7252,7 +7352,8 @@ var anyUnknownInErrorContext = createDiagnostic({
7252
7352
  if (ts.isParameter(node) || ts.isPropertyDeclaration(node) || ts.isVariableDeclaration(node)) {
7253
7353
  if (node.type) {
7254
7354
  const typeNode = node.type;
7255
- const type2 = typeChecker.getTypeAtLocation(node.type);
7355
+ const type2 = typeCheckerUtils.getTypeAtLocation(node.type);
7356
+ if (!type2) continue;
7256
7357
  const expectedEffect = yield* pipe(
7257
7358
  typeParser.strictEffectType(type2, node.type),
7258
7359
  orElse2(() => typeParser.layerType(type2, typeNode)),
@@ -7263,11 +7364,7 @@ var anyUnknownInErrorContext = createDiagnostic({
7263
7364
  }
7264
7365
  ts.forEachChild(node, appendNodeToVisit);
7265
7366
  if (!ts.isExpression(node)) continue;
7266
- if (node.parent && ts.isJsxSelfClosingElement(node.parent) && node.parent.tagName === node) continue;
7267
- if (node.parent && ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node) continue;
7268
- if (node.parent && ts.isJsxClosingElement(node.parent) && node.parent.tagName === node) continue;
7269
- if (node.parent && ts.isJsxAttribute(node.parent) && node.parent.name === node) continue;
7270
- let type = typeChecker.getTypeAtLocation(node);
7367
+ let type = typeCheckerUtils.getTypeAtLocation(node);
7271
7368
  if (ts.isCallExpression(node)) {
7272
7369
  const resolvedSignature = typeChecker.getResolvedSignature(node);
7273
7370
  if (resolvedSignature) {
@@ -7333,11 +7430,13 @@ var anyUnknownInErrorContext = createDiagnostic({
7333
7430
  var catchUnfailableEffect = createDiagnostic({
7334
7431
  name: "catchUnfailableEffect",
7335
7432
  code: 2,
7433
+ description: "Warns when using error handling on Effects that never fail (error type is 'never')",
7336
7434
  severity: "suggestion",
7337
7435
  apply: fn("catchUnfailableEffect.apply")(function* (sourceFile, report) {
7338
7436
  const ts = yield* service(TypeScriptApi);
7339
7437
  const typeParser = yield* service(TypeParser);
7340
7438
  const typeChecker = yield* service(TypeCheckerApi);
7439
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
7341
7440
  const nodeToVisit = [];
7342
7441
  const appendNodeToVisit = (node) => {
7343
7442
  nodeToVisit.push(node);
@@ -7368,7 +7467,7 @@ var catchUnfailableEffect = createDiagnostic({
7368
7467
  if (argIndex !== -1) {
7369
7468
  let effectTypeToCheck;
7370
7469
  if (argIndex === 0) {
7371
- effectTypeToCheck = typeChecker.getTypeAtLocation(subject);
7470
+ effectTypeToCheck = typeCheckerUtils.getTypeAtLocation(subject);
7372
7471
  } else {
7373
7472
  const signature = typeChecker.getResolvedSignature(pipeCallNode);
7374
7473
  if (signature) {
@@ -7407,6 +7506,7 @@ var catchUnfailableEffect = createDiagnostic({
7407
7506
  var classSelfMismatch = createDiagnostic({
7408
7507
  name: "classSelfMismatch",
7409
7508
  code: 20,
7509
+ description: "Ensures Self type parameter matches the class name in Service/Tag/Schema classes",
7410
7510
  severity: "error",
7411
7511
  apply: fn("classSelfMismatch.apply")(function* (sourceFile, report) {
7412
7512
  const ts = yield* service(TypeScriptApi);
@@ -7428,6 +7528,7 @@ var classSelfMismatch = createDiagnostic({
7428
7528
  orElse2(() => typeParser.extendsSchemaTaggedClass(node)),
7429
7529
  orElse2(() => typeParser.extendsSchemaTaggedError(node)),
7430
7530
  orElse2(() => typeParser.extendsSchemaTaggedRequest(node)),
7531
+ orElse2(() => typeParser.extendsEffectSqlModelClass(node)),
7431
7532
  orElse2(() => void_)
7432
7533
  );
7433
7534
  if (result) {
@@ -7471,6 +7572,7 @@ var classSelfMismatch = createDiagnostic({
7471
7572
  var deterministicKeys = createDiagnostic({
7472
7573
  name: "deterministicKeys",
7473
7574
  code: 25,
7575
+ description: "Enforces deterministic naming for service/tag/error identifiers based on class names",
7474
7576
  severity: "off",
7475
7577
  apply: fn("deterministicKeys.apply")(function* (sourceFile, report) {
7476
7578
  const ts = yield* service(TypeScriptApi);
@@ -7591,6 +7693,7 @@ var programResolvedCacheSize = /* @__PURE__ */ new Map();
7591
7693
  var duplicatePackage = createDiagnostic({
7592
7694
  name: "duplicatePackage",
7593
7695
  code: 6,
7696
+ description: "Detects when multiple versions of the same Effect package are loaded",
7594
7697
  severity: "warning",
7595
7698
  apply: fn("duplicatePackage.apply")(function* (sourceFile, report) {
7596
7699
  const program = yield* service(TypeScriptProgram);
@@ -7638,6 +7741,7 @@ ${versions.map((version) => `- found ${version} at ${resolvedPackages[packageNam
7638
7741
  var effectGenUsesAdapter = createDiagnostic({
7639
7742
  name: "effectGenUsesAdapter",
7640
7743
  code: 23,
7744
+ description: "Warns when using the deprecated adapter parameter in Effect.gen",
7641
7745
  severity: "warning",
7642
7746
  apply: fn("effectGenUsesAdapter.apply")(function* (sourceFile, report) {
7643
7747
  const ts = yield* service(TypeScriptApi);
@@ -7675,6 +7779,7 @@ var effectGenUsesAdapter = createDiagnostic({
7675
7779
  var effectInVoidSuccess = createDiagnostic({
7676
7780
  name: "effectInVoidSuccess",
7677
7781
  code: 14,
7782
+ description: "Detects nested Effects in void success channels that may cause unexecuted effects",
7678
7783
  severity: "warning",
7679
7784
  apply: fn("effectInVoidSuccess.apply")(function* (sourceFile, report) {
7680
7785
  const ts = yield* service(TypeScriptApi);
@@ -7723,10 +7828,12 @@ var effectInVoidSuccess = createDiagnostic({
7723
7828
  var floatingEffect = createDiagnostic({
7724
7829
  name: "floatingEffect",
7725
7830
  code: 3,
7831
+ description: "Ensures Effects are yielded or assigned to variables, not left floating",
7726
7832
  severity: "error",
7727
7833
  apply: fn("floatingEffect.apply")(function* (sourceFile, report) {
7728
7834
  const ts = yield* service(TypeScriptApi);
7729
7835
  const typeChecker = yield* service(TypeCheckerApi);
7836
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
7730
7837
  const typeParser = yield* service(TypeParser);
7731
7838
  function isFloatingExpression(node) {
7732
7839
  if (!ts.isExpressionStatement(node)) return false;
@@ -7745,7 +7852,8 @@ var floatingEffect = createDiagnostic({
7745
7852
  const node = nodeToVisit.shift();
7746
7853
  ts.forEachChild(node, appendNodeToVisit);
7747
7854
  if (!isFloatingExpression(node)) continue;
7748
- const type = typeChecker.getTypeAtLocation(node.expression);
7855
+ const type = typeCheckerUtils.getTypeAtLocation(node.expression);
7856
+ if (!type) continue;
7749
7857
  const effect = yield* option(typeParser.effectType(type, node.expression));
7750
7858
  if (isSome2(effect)) {
7751
7859
  const allowedFloatingEffects = yield* pipe(
@@ -7771,6 +7879,7 @@ var floatingEffect = createDiagnostic({
7771
7879
  var genericEffectServices = createDiagnostic({
7772
7880
  name: "genericEffectServices",
7773
7881
  code: 10,
7882
+ description: "Prevents services with type parameters that cannot be discriminated at runtime",
7774
7883
  severity: "warning",
7775
7884
  apply: fn("genericEffectServices.apply")(function* (sourceFile, report) {
7776
7885
  const ts = yield* service(TypeScriptApi);
@@ -7813,10 +7922,56 @@ var genericEffectServices = createDiagnostic({
7813
7922
  })
7814
7923
  });
7815
7924
 
7925
+ // src/diagnostics/globalErrorInEffectFailure.ts
7926
+ var globalErrorInEffectFailure = createDiagnostic({
7927
+ name: "globalErrorInEffectFailure",
7928
+ code: 35,
7929
+ description: "Warns when Effect.fail is called with the global Error type",
7930
+ severity: "warning",
7931
+ apply: fn("globalErrorInEffectFailure.apply")(function* (sourceFile, report) {
7932
+ const ts = yield* service(TypeScriptApi);
7933
+ const typeParser = yield* service(TypeParser);
7934
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
7935
+ const nodeToVisit = [];
7936
+ const appendNodeToVisit = (node) => {
7937
+ nodeToVisit.push(node);
7938
+ return void 0;
7939
+ };
7940
+ ts.forEachChild(sourceFile, appendNodeToVisit);
7941
+ while (nodeToVisit.length > 0) {
7942
+ const node = nodeToVisit.shift();
7943
+ ts.forEachChild(node, appendNodeToVisit);
7944
+ if (ts.isCallExpression(node)) {
7945
+ yield* pipe(
7946
+ typeParser.isNodeReferenceToEffectModuleApi("fail")(node.expression),
7947
+ flatMap4(() => {
7948
+ if (node.arguments.length > 0) {
7949
+ const failArgument = node.arguments[0];
7950
+ const argumentType = typeCheckerUtils.getTypeAtLocation(failArgument);
7951
+ if (argumentType && typeCheckerUtils.isGlobalErrorType(argumentType)) {
7952
+ return sync(
7953
+ () => report({
7954
+ location: node,
7955
+ messageText: `Effect.fail is called with the global Error type. It's not recommended to use the global Error type in Effect failures as they can get merged together. Instead, use tagged errors (Data.TaggedError) or custom errors with a discriminator property to get properly type-checked errors.`,
7956
+ fixes: []
7957
+ })
7958
+ );
7959
+ }
7960
+ }
7961
+ return void_;
7962
+ }),
7963
+ ignore
7964
+ );
7965
+ }
7966
+ }
7967
+ })
7968
+ });
7969
+
7816
7970
  // src/diagnostics/importFromBarrel.ts
7817
7971
  var importFromBarrel = createDiagnostic({
7818
7972
  name: "importFromBarrel",
7819
7973
  code: 12,
7974
+ description: "Suggests importing from specific module paths instead of barrel exports",
7820
7975
  severity: "off",
7821
7976
  apply: fn("importFromBarrel.apply")(function* (sourceFile, report) {
7822
7977
  const languageServicePluginOptions = yield* service(LanguageServicePluginOptions);
@@ -7956,6 +8111,7 @@ var importFromBarrel = createDiagnostic({
7956
8111
  var leakingRequirements = createDiagnostic({
7957
8112
  name: "leakingRequirements",
7958
8113
  code: 8,
8114
+ description: "Detects implementation services leaked in service methods",
7959
8115
  severity: "suggestion",
7960
8116
  apply: fn("leakingRequirements.apply")(function* (sourceFile, report) {
7961
8117
  const ts = yield* service(TypeScriptApi);
@@ -8063,7 +8219,8 @@ More info at https://effect.website/docs/requirements-management/layers/#avoidin
8063
8219
  const node = nodeToVisit.shift();
8064
8220
  const typesToCheck = [];
8065
8221
  if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "GenericTag") {
8066
- typesToCheck.push([typeChecker.getTypeAtLocation(node), node]);
8222
+ const nodeType = typeCheckerUtils.getTypeAtLocation(node);
8223
+ if (nodeType) typesToCheck.push([nodeType, node]);
8067
8224
  } else if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
8068
8225
  const classSym = typeChecker.getSymbolAtLocation(node.name);
8069
8226
  if (classSym) {
@@ -8097,10 +8254,12 @@ More info at https://effect.website/docs/requirements-management/layers/#avoidin
8097
8254
  var missedPipeableOpportunity = createDiagnostic({
8098
8255
  name: "missedPipeableOpportunity",
8099
8256
  code: 26,
8257
+ description: "Enforces the use of pipeable style for nested function calls",
8100
8258
  severity: "off",
8101
8259
  apply: fn("missedPipeableOpportunity.apply")(function* (sourceFile, report) {
8102
8260
  const ts = yield* service(TypeScriptApi);
8103
8261
  const typeChecker = yield* service(TypeCheckerApi);
8262
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
8104
8263
  const typeParser = yield* service(TypeParser);
8105
8264
  const options = yield* service(LanguageServicePluginOptions);
8106
8265
  const nodeToVisit = [sourceFile];
@@ -8131,7 +8290,8 @@ var missedPipeableOpportunity = createDiagnostic({
8131
8290
  const originalParentChain = parentChain.slice();
8132
8291
  while (parentChain.length > options.pipeableMinArgCount) {
8133
8292
  const subject = parentChain.pop();
8134
- const resultType = typeChecker.getTypeAtLocation(subject);
8293
+ const resultType = typeCheckerUtils.getTypeAtLocation(subject);
8294
+ if (!resultType) continue;
8135
8295
  const pipeableType = yield* pipe(typeParser.pipeableType(resultType, subject), orElse2(() => void_));
8136
8296
  if (pipeableType) {
8137
8297
  report({
@@ -8176,6 +8336,7 @@ var missedPipeableOpportunity = createDiagnostic({
8176
8336
  var missingEffectContext = createDiagnostic({
8177
8337
  name: "missingEffectContext",
8178
8338
  code: 1,
8339
+ description: "Reports missing service requirements in Effect context channel",
8179
8340
  severity: "error",
8180
8341
  apply: fn("missingEffectContext.apply")(function* (sourceFile, report) {
8181
8342
  const typeChecker = yield* service(TypeCheckerApi);
@@ -8224,6 +8385,7 @@ var missingEffectContext = createDiagnostic({
8224
8385
  var missingEffectError = createDiagnostic({
8225
8386
  name: "missingEffectError",
8226
8387
  code: 1,
8388
+ description: "Reports missing error types in Effect error channel",
8227
8389
  severity: "error",
8228
8390
  apply: fn("missingEffectError.apply")(function* (sourceFile, report) {
8229
8391
  const ts = yield* service(TypeScriptApi);
@@ -8363,6 +8525,7 @@ var missingEffectError = createDiagnostic({
8363
8525
  var missingEffectServiceDependency = createDiagnostic({
8364
8526
  name: "missingEffectServiceDependency",
8365
8527
  code: 22,
8528
+ description: "Checks that Effect.Service dependencies satisfy all required layer inputs",
8366
8529
  severity: "off",
8367
8530
  apply: fn("missingEffectServiceDependency.apply")(function* (sourceFile, report) {
8368
8531
  const ts = yield* service(TypeScriptApi);
@@ -8404,13 +8567,15 @@ var missingEffectServiceDependency = createDiagnostic({
8404
8567
  excludeNever
8405
8568
  );
8406
8569
  const providedIndexes = /* @__PURE__ */ new Set();
8407
- const optionsType = typeChecker.getTypeAtLocation(options);
8408
- const dependenciesProperty = typeChecker.getPropertyOfType(optionsType, "dependencies");
8409
8570
  let types = [];
8410
- if (dependenciesProperty) {
8411
- const dependenciesTypes = typeChecker.getTypeOfSymbolAtLocation(dependenciesProperty, options);
8412
- const numberIndexType = typeChecker.getIndexTypeOfType(dependenciesTypes, ts.IndexKind.Number);
8413
- types = numberIndexType ? typeCheckerUtils.unrollUnionMembers(numberIndexType) : [];
8571
+ const optionsType = typeCheckerUtils.getTypeAtLocation(options);
8572
+ if (optionsType) {
8573
+ const dependenciesProperty = typeChecker.getPropertyOfType(optionsType, "dependencies");
8574
+ if (dependenciesProperty) {
8575
+ const dependenciesTypes = typeChecker.getTypeOfSymbolAtLocation(dependenciesProperty, options);
8576
+ const numberIndexType = typeChecker.getIndexTypeOfType(dependenciesTypes, ts.IndexKind.Number);
8577
+ types = numberIndexType ? typeCheckerUtils.unrollUnionMembers(numberIndexType) : [];
8578
+ }
8414
8579
  }
8415
8580
  for (const depType of types) {
8416
8581
  const depLayerResult = yield* pipe(
@@ -8453,10 +8618,11 @@ var missingEffectServiceDependency = createDiagnostic({
8453
8618
  var missingReturnYieldStar = createDiagnostic({
8454
8619
  name: "missingReturnYieldStar",
8455
8620
  code: 7,
8621
+ description: "Suggests using 'return yield*' for Effects with never success for better type narrowing",
8456
8622
  severity: "error",
8457
8623
  apply: fn("missingReturnYieldStar.apply")(function* (sourceFile, report) {
8458
8624
  const ts = yield* service(TypeScriptApi);
8459
- const typeChecker = yield* service(TypeCheckerApi);
8625
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
8460
8626
  const typeParser = yield* service(TypeParser);
8461
8627
  const nodeToVisit = [];
8462
8628
  const appendNodeToVisit = (node) => {
@@ -8468,42 +8634,44 @@ var missingReturnYieldStar = createDiagnostic({
8468
8634
  const node = nodeToVisit.shift();
8469
8635
  ts.forEachChild(node, appendNodeToVisit);
8470
8636
  if (ts.isYieldExpression(node) && node.expression && node.asteriskToken) {
8471
- const type = typeChecker.getTypeAtLocation(node.expression);
8472
- const maybeEffect = yield* option(typeParser.effectType(type, node.expression));
8473
- if (isSome2(maybeEffect) && maybeEffect.value.A.flags & ts.TypeFlags.Never) {
8474
- const generatorFunctionOrReturnStatement = ts.findAncestor(
8475
- node,
8476
- (_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isReturnStatement(_) || ts.isThrowStatement(_)
8477
- );
8478
- if (generatorFunctionOrReturnStatement && !ts.isReturnStatement(generatorFunctionOrReturnStatement) && !ts.isThrowStatement(generatorFunctionOrReturnStatement)) {
8479
- if (generatorFunctionOrReturnStatement && generatorFunctionOrReturnStatement.parent) {
8480
- const effectGenNode = generatorFunctionOrReturnStatement.parent;
8481
- const effectGenLike = yield* pipe(
8482
- typeParser.effectGen(effectGenNode),
8483
- orElse2(() => typeParser.effectFnUntracedGen(effectGenNode)),
8484
- orElse2(() => typeParser.effectFnGen(effectGenNode)),
8485
- option
8486
- );
8487
- if (isSome2(effectGenLike)) {
8488
- const fix = node.expression ? [{
8489
- fixName: "missingReturnYieldStar_fix",
8490
- description: "Add return statement",
8491
- apply: gen(function* () {
8492
- const changeTracker = yield* service(ChangeTracker);
8493
- changeTracker.replaceNode(
8494
- sourceFile,
8495
- node,
8496
- ts.factory.createReturnStatement(
8497
- node
8498
- )
8499
- );
8500
- })
8501
- }] : [];
8502
- report({
8503
- location: node,
8504
- messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
8505
- fixes: fix
8506
- });
8637
+ const type = typeCheckerUtils.getTypeAtLocation(node.expression);
8638
+ if (type) {
8639
+ const maybeEffect = yield* option(typeParser.effectType(type, node.expression));
8640
+ if (isSome2(maybeEffect) && maybeEffect.value.A.flags & ts.TypeFlags.Never) {
8641
+ const generatorFunctionOrReturnStatement = ts.findAncestor(
8642
+ node,
8643
+ (_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isReturnStatement(_) || ts.isThrowStatement(_)
8644
+ );
8645
+ if (generatorFunctionOrReturnStatement && !ts.isReturnStatement(generatorFunctionOrReturnStatement) && !ts.isThrowStatement(generatorFunctionOrReturnStatement)) {
8646
+ if (generatorFunctionOrReturnStatement && generatorFunctionOrReturnStatement.parent) {
8647
+ const effectGenNode = generatorFunctionOrReturnStatement.parent;
8648
+ const effectGenLike = yield* pipe(
8649
+ typeParser.effectGen(effectGenNode),
8650
+ orElse2(() => typeParser.effectFnUntracedGen(effectGenNode)),
8651
+ orElse2(() => typeParser.effectFnGen(effectGenNode)),
8652
+ option
8653
+ );
8654
+ if (isSome2(effectGenLike)) {
8655
+ const fix = node.expression ? [{
8656
+ fixName: "missingReturnYieldStar_fix",
8657
+ description: "Add return statement",
8658
+ apply: gen(function* () {
8659
+ const changeTracker = yield* service(ChangeTracker);
8660
+ changeTracker.replaceNode(
8661
+ sourceFile,
8662
+ node,
8663
+ ts.factory.createReturnStatement(
8664
+ node
8665
+ )
8666
+ );
8667
+ })
8668
+ }] : [];
8669
+ report({
8670
+ location: node,
8671
+ messageText: `It is recommended to use return yield* for Effects that never succeed to signal a definitive exit point for type narrowing and tooling support.`,
8672
+ fixes: fix
8673
+ });
8674
+ }
8507
8675
  }
8508
8676
  }
8509
8677
  }
@@ -8517,6 +8685,7 @@ var missingReturnYieldStar = createDiagnostic({
8517
8685
  var missingStarInYieldEffectGen = createDiagnostic({
8518
8686
  name: "missingStarInYieldEffectGen",
8519
8687
  code: 4,
8688
+ description: "Enforces using 'yield*' instead of 'yield' when yielding Effects in generators",
8520
8689
  severity: "error",
8521
8690
  apply: fn("missingStarInYieldEffectGen.apply")(function* (sourceFile, report) {
8522
8691
  const ts = yield* service(TypeScriptApi);
@@ -8591,11 +8760,12 @@ var missingStarInYieldEffectGen = createDiagnostic({
8591
8760
  var multipleEffectProvide = createDiagnostic({
8592
8761
  name: "multipleEffectProvide",
8593
8762
  code: 18,
8763
+ description: "Warns against chaining Effect.provide calls which can cause service lifecycle issues",
8594
8764
  severity: "warning",
8595
8765
  apply: fn("multipleEffectProvide.apply")(function* (sourceFile, report) {
8596
8766
  const ts = yield* service(TypeScriptApi);
8597
8767
  const tsUtils = yield* service(TypeScriptUtils);
8598
- const typeChecker = yield* service(TypeCheckerApi);
8768
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
8599
8769
  const typeParser = yield* service(TypeParser);
8600
8770
  const effectModuleIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
8601
8771
  sourceFile,
@@ -8610,7 +8780,8 @@ var multipleEffectProvide = createDiagnostic({
8610
8780
  const parseEffectProvideLayer = (node) => {
8611
8781
  if (ts.isCallExpression(node) && node.arguments.length > 0) {
8612
8782
  const layer = node.arguments[0];
8613
- const type = typeChecker.getTypeAtLocation(layer);
8783
+ const type = typeCheckerUtils.getTypeAtLocation(layer);
8784
+ if (!type) return void_;
8614
8785
  return pipe(
8615
8786
  typeParser.isNodeReferenceToEffectModuleApi("provide")(node.expression),
8616
8787
  flatMap4(() => typeParser.layerType(type, layer)),
@@ -8688,6 +8859,7 @@ var multipleEffectProvide = createDiagnostic({
8688
8859
  var nonObjectEffectServiceType = createDiagnostic({
8689
8860
  name: "nonObjectEffectServiceType",
8690
8861
  code: 24,
8862
+ description: "Ensures Effect.Service types are objects, not primitives",
8691
8863
  severity: "error",
8692
8864
  apply: fn("nonObjectEffectServiceType.apply")(function* (sourceFile, report) {
8693
8865
  const ts = yield* service(TypeScriptApi);
@@ -8726,12 +8898,13 @@ var nonObjectEffectServiceType = createDiagnostic({
8726
8898
  fixes: []
8727
8899
  };
8728
8900
  if (propertyName === "succeed") {
8729
- const valueType = typeChecker.getTypeAtLocation(propertyValue);
8730
- if (isPrimitiveType(valueType)) {
8901
+ const valueType = typeCheckerUtils.getTypeAtLocation(propertyValue);
8902
+ if (valueType && isPrimitiveType(valueType)) {
8731
8903
  report(errorToReport);
8732
8904
  }
8733
8905
  } else if (propertyName === "sync") {
8734
- const valueType = typeChecker.getTypeAtLocation(propertyValue);
8906
+ const valueType = typeCheckerUtils.getTypeAtLocation(propertyValue);
8907
+ if (!valueType) continue;
8735
8908
  const signatures = typeChecker.getSignaturesOfType(valueType, ts.SignatureKind.Call);
8736
8909
  for (const signature of signatures) {
8737
8910
  const returnType = typeChecker.getReturnTypeOfSignature(signature);
@@ -8741,7 +8914,8 @@ var nonObjectEffectServiceType = createDiagnostic({
8741
8914
  }
8742
8915
  }
8743
8916
  } else if (propertyName === "effect" || propertyName === "scoped") {
8744
- const valueType = typeChecker.getTypeAtLocation(propertyValue);
8917
+ const valueType = typeCheckerUtils.getTypeAtLocation(propertyValue);
8918
+ if (!valueType) continue;
8745
8919
  const effectResult = yield* pipe(
8746
8920
  typeParser.effectType(valueType, propertyValue),
8747
8921
  orElse2(() => void_)
@@ -8778,6 +8952,7 @@ var nonObjectEffectServiceType = createDiagnostic({
8778
8952
  var outdatedEffectCodegen = createDiagnostic({
8779
8953
  name: "outdatedEffectCodegen",
8780
8954
  code: 19,
8955
+ description: "Detects when generated code is outdated and needs to be regenerated",
8781
8956
  severity: "warning",
8782
8957
  apply: fn("outdatedEffectCodegen.apply")(function* (sourceFile, _report) {
8783
8958
  const codegensWithRanges = yield* getCodegensForSourceFile(codegens, sourceFile);
@@ -8823,11 +8998,12 @@ var outdatedEffectCodegen = createDiagnostic({
8823
8998
  var overriddenSchemaConstructor = createDiagnostic({
8824
8999
  name: "overriddenSchemaConstructor",
8825
9000
  code: 30,
9001
+ description: "Prevents overriding constructors in Schema classes which breaks decoding behavior",
8826
9002
  severity: "error",
8827
9003
  apply: fn("overriddenSchemaConstructor.apply")(function* (sourceFile, report) {
8828
9004
  const ts = yield* service(TypeScriptApi);
8829
9005
  const typeParser = yield* service(TypeParser);
8830
- const typeChecker = yield* service(TypeCheckerApi);
9006
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
8831
9007
  function isAllowedConstructor(node) {
8832
9008
  if (node.body && node.body.statements.length === 1) {
8833
9009
  const expressionStatement = node.body.statements[0];
@@ -8861,7 +9037,8 @@ var overriddenSchemaConstructor = createDiagnostic({
8861
9037
  for (const heritageClause of node.heritageClauses) {
8862
9038
  if (heritageClause.token === ts.SyntaxKind.ExtendsKeyword) {
8863
9039
  for (const type of heritageClause.types) {
8864
- const typeAtLocation = typeChecker.getTypeAtLocation(type.expression);
9040
+ const typeAtLocation = typeCheckerUtils.getTypeAtLocation(type.expression);
9041
+ if (!typeAtLocation) continue;
8865
9042
  const isSchema = yield* pipe(
8866
9043
  typeParser.effectSchemaType(typeAtLocation, type.expression),
8867
9044
  map8(() => true),
@@ -8958,10 +9135,11 @@ var overriddenSchemaConstructor = createDiagnostic({
8958
9135
  var returnEffectInGen = createDiagnostic({
8959
9136
  name: "returnEffectInGen",
8960
9137
  code: 11,
9138
+ description: "Warns when returning an Effect in a generator causes nested Effect<Effect<...>>",
8961
9139
  severity: "suggestion",
8962
9140
  apply: fn("returnEffectInGen.apply")(function* (sourceFile, report) {
8963
9141
  const ts = yield* service(TypeScriptApi);
8964
- const typeChecker = yield* service(TypeCheckerApi);
9142
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
8965
9143
  const typeParser = yield* service(TypeParser);
8966
9144
  const nodeToVisit = [];
8967
9145
  const appendNodeToVisit = (node) => {
@@ -8979,7 +9157,8 @@ var returnEffectInGen = createDiagnostic({
8979
9157
  (_) => ts.isFunctionExpression(_) || ts.isFunctionDeclaration(_) || ts.isMethodDeclaration(_) || ts.isArrowFunction(_) || ts.isGetAccessor(_)
8980
9158
  );
8981
9159
  if (!(generatorOrRegularFunction && "asteriskToken" in generatorOrRegularFunction && generatorOrRegularFunction.asteriskToken)) continue;
8982
- const type = typeChecker.getTypeAtLocation(node.expression);
9160
+ const type = typeCheckerUtils.getTypeAtLocation(node.expression);
9161
+ if (!type) continue;
8983
9162
  const maybeEffect = yield* option(typeParser.strictEffectType(type, node.expression));
8984
9163
  if (isSome2(maybeEffect)) {
8985
9164
  if (generatorOrRegularFunction && generatorOrRegularFunction.parent) {
@@ -9025,6 +9204,7 @@ Nested Effect-able types may be intended if you plan to later manually flatten o
9025
9204
  var runEffectInsideEffect = createDiagnostic({
9026
9205
  name: "runEffectInsideEffect",
9027
9206
  code: 32,
9207
+ description: "Suggests using Runtime methods instead of Effect.run* inside Effect contexts",
9028
9208
  severity: "suggestion",
9029
9209
  apply: fn("runEffectInsideEffect.apply")(function* (sourceFile, report) {
9030
9210
  const ts = yield* service(TypeScriptApi);
@@ -9164,6 +9344,7 @@ Consider extracting the Runtime by using for example Effect.runtime and then use
9164
9344
  var schemaStructWithTag = createDiagnostic({
9165
9345
  name: "schemaStructWithTag",
9166
9346
  code: 34,
9347
+ description: "Suggests using Schema.TaggedStruct instead of Schema.Struct with _tag field",
9167
9348
  severity: "suggestion",
9168
9349
  apply: fn("schemaStructWithTag.apply")(function* (sourceFile, report) {
9169
9350
  const ts = yield* service(TypeScriptApi);
@@ -9243,6 +9424,7 @@ var schemaStructWithTag = createDiagnostic({
9243
9424
  var schemaUnionOfLiterals = createDiagnostic({
9244
9425
  name: "schemaUnionOfLiterals",
9245
9426
  code: 33,
9427
+ description: "Simplifies Schema.Union of multiple Schema.Literal calls into single Schema.Literal",
9246
9428
  severity: "off",
9247
9429
  apply: fn("schemaUnionOfLiterals.apply")(function* (sourceFile, report) {
9248
9430
  const ts = yield* service(TypeScriptApi);
@@ -9316,6 +9498,7 @@ var schemaUnionOfLiterals = createDiagnostic({
9316
9498
  var scopeInLayerEffect = createDiagnostic({
9317
9499
  name: "scopeInLayerEffect",
9318
9500
  code: 13,
9501
+ description: "Suggests using Layer.scoped instead of Layer.effect when Scope is in requirements",
9319
9502
  severity: "warning",
9320
9503
  apply: fn("scopeInLayerEffect.apply")(function* (sourceFile, report) {
9321
9504
  const ts = yield* service(TypeScriptApi);
@@ -9374,12 +9557,14 @@ Consider using "scoped" instead to get rid of the scope in the requirements.`,
9374
9557
  const node = nodeToVisit.shift();
9375
9558
  const layerEffectApiCall = parseLayerEffectApiCall(node);
9376
9559
  if (layerEffectApiCall) {
9377
- const type = typeChecker.getTypeAtLocation(node);
9378
- yield* pipe(
9379
- typeParser.layerType(type, node),
9380
- flatMap4(({ RIn }) => reportIfLayerRequireScope(RIn, node, layerEffectApiCall.methodIdentifier)),
9381
- ignore
9382
- );
9560
+ const type = typeCheckerUtils.getTypeAtLocation(node);
9561
+ if (type) {
9562
+ yield* pipe(
9563
+ typeParser.layerType(type, node),
9564
+ flatMap4(({ RIn }) => reportIfLayerRequireScope(RIn, node, layerEffectApiCall.methodIdentifier)),
9565
+ ignore
9566
+ );
9567
+ }
9383
9568
  continue;
9384
9569
  }
9385
9570
  if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
@@ -9407,6 +9592,7 @@ Consider using "scoped" instead to get rid of the scope in the requirements.`,
9407
9592
  var strictBooleanExpressions = createDiagnostic({
9408
9593
  name: "strictBooleanExpressions",
9409
9594
  code: 17,
9595
+ description: "Enforces boolean types in conditional expressions for type safety",
9410
9596
  severity: "off",
9411
9597
  apply: fn("strictBooleanExpressions.apply")(function* (sourceFile, report) {
9412
9598
  const ts = yield* service(TypeScriptApi);
@@ -9448,7 +9634,8 @@ var strictBooleanExpressions = createDiagnostic({
9448
9634
  if (!nodeToCheck) continue;
9449
9635
  if (!conditionChecks.has(nodeToCheck.parent)) continue;
9450
9636
  if (!ts.isExpression(nodeToCheck)) continue;
9451
- const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
9637
+ const nodeType = typeCheckerUtils.getTypeAtLocation(nodeToCheck);
9638
+ if (!nodeType) continue;
9452
9639
  const constrainedType = typeChecker.getBaseConstraintOfType(nodeType);
9453
9640
  let typesToCheck = [constrainedType || nodeType];
9454
9641
  while (typesToCheck.length > 0) {
@@ -9476,10 +9663,11 @@ var strictBooleanExpressions = createDiagnostic({
9476
9663
  var strictEffectProvide = createDiagnostic({
9477
9664
  name: "strictEffectProvide",
9478
9665
  code: 27,
9666
+ description: "Warns when using Effect.provide with layers outside of application entry points",
9479
9667
  severity: "off",
9480
9668
  apply: fn("strictEffectProvide.apply")(function* (sourceFile, report) {
9481
9669
  const ts = yield* service(TypeScriptApi);
9482
- const typeChecker = yield* service(TypeCheckerApi);
9670
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
9483
9671
  const typeParser = yield* service(TypeParser);
9484
9672
  const parseEffectProvideWithLayer = (node) => gen(function* () {
9485
9673
  if (!ts.isCallExpression(node) || node.arguments.length === 0) {
@@ -9488,7 +9676,8 @@ var strictEffectProvide = createDiagnostic({
9488
9676
  yield* typeParser.isNodeReferenceToEffectModuleApi("provide")(node.expression);
9489
9677
  return yield* firstSuccessOf(
9490
9678
  node.arguments.map((arg) => {
9491
- const argType = typeChecker.getTypeAtLocation(arg);
9679
+ const argType = typeCheckerUtils.getTypeAtLocation(arg);
9680
+ if (!argType) return typeParserIssue("Could not get argument type");
9492
9681
  return typeParser.layerType(argType, arg);
9493
9682
  })
9494
9683
  );
@@ -9520,6 +9709,7 @@ var strictEffectProvide = createDiagnostic({
9520
9709
  var tryCatchInEffectGen = createDiagnostic({
9521
9710
  name: "tryCatchInEffectGen",
9522
9711
  code: 15,
9712
+ description: "Discourages try/catch in Effect generators in favor of Effect error handling",
9523
9713
  severity: "suggestion",
9524
9714
  apply: fn("tryCatchInEffectGen.apply")(function* (sourceFile, report) {
9525
9715
  const ts = yield* service(TypeScriptApi);
@@ -9565,6 +9755,7 @@ var tryCatchInEffectGen = createDiagnostic({
9565
9755
  var unknownInEffectCatch = createDiagnostic({
9566
9756
  name: "unknownInEffectCatch",
9567
9757
  code: 31,
9758
+ description: "Warns when catch callbacks return unknown instead of typed errors",
9568
9759
  severity: "warning",
9569
9760
  apply: fn("unknownInEffectCatch.apply")(function* (sourceFile, report) {
9570
9761
  const ts = yield* service(TypeScriptApi);
@@ -9622,6 +9813,7 @@ Consider wrapping unknown errors into Effect's Data.TaggedError for example, or
9622
9813
  var unnecessaryEffectGen = createDiagnostic({
9623
9814
  name: "unnecessaryEffectGen",
9624
9815
  code: 5,
9816
+ description: "Suggests removing Effect.gen when it contains only a single return statement",
9625
9817
  severity: "suggestion",
9626
9818
  apply: fn("unnecessaryEffectGen.apply")(function* (sourceFile, report) {
9627
9819
  const ts = yield* service(TypeScriptApi);
@@ -9665,15 +9857,12 @@ var unnecessaryEffectGen = createDiagnostic({
9665
9857
  var unnecessaryFailYieldableError = createDiagnostic({
9666
9858
  name: "unnecessaryFailYieldableError",
9667
9859
  code: 29,
9860
+ description: "Suggests yielding yieldable errors directly instead of wrapping with Effect.fail",
9668
9861
  severity: "suggestion",
9669
9862
  apply: fn("unnecessaryFailYieldableError.apply")(function* (sourceFile, report) {
9670
9863
  const ts = yield* service(TypeScriptApi);
9671
9864
  const typeParser = yield* service(TypeParser);
9672
- const typeChecker = yield* service(TypeCheckerApi);
9673
- const yieldableErrorTypes = yield* pipe(
9674
- typeParser.effectCauseYieldableErrorTypes(sourceFile),
9675
- orElse2(() => succeed([]))
9676
- );
9865
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
9677
9866
  const nodeToVisit = [];
9678
9867
  const appendNodeToVisit = (node) => {
9679
9868
  nodeToVisit.push(node);
@@ -9687,32 +9876,34 @@ var unnecessaryFailYieldableError = createDiagnostic({
9687
9876
  const callExpression = node.expression;
9688
9877
  yield* pipe(
9689
9878
  typeParser.isNodeReferenceToEffectModuleApi("fail")(callExpression.expression),
9690
- map8(() => {
9879
+ flatMap4(() => {
9691
9880
  if (callExpression.arguments.length > 0) {
9692
9881
  const failArgument = callExpression.arguments[0];
9693
- const argumentType = typeChecker.getTypeAtLocation(failArgument);
9694
- const isYieldableError = yieldableErrorTypes.some(
9695
- (yieldableType) => typeChecker.isTypeAssignableTo(argumentType, yieldableType)
9882
+ const argumentType = typeCheckerUtils.getTypeAtLocation(failArgument);
9883
+ if (!argumentType) return void_;
9884
+ return pipe(
9885
+ typeParser.extendsCauseYieldableError(argumentType),
9886
+ map8(
9887
+ () => report({
9888
+ location: node,
9889
+ messageText: `This Effect.fail call uses a yieldable error type as argument. You can yield* the error directly instead.`,
9890
+ fixes: [{
9891
+ fixName: "unnecessaryFailYieldableError_fix",
9892
+ description: "Replace yield* Effect.fail with yield*",
9893
+ apply: gen(function* () {
9894
+ const changeTracker = yield* service(ChangeTracker);
9895
+ changeTracker.replaceNode(
9896
+ sourceFile,
9897
+ callExpression,
9898
+ failArgument
9899
+ );
9900
+ })
9901
+ }]
9902
+ })
9903
+ )
9696
9904
  );
9697
- if (isYieldableError) {
9698
- report({
9699
- location: node,
9700
- messageText: `This Effect.fail call uses a yieldable error type as argument. You can yield* the error directly instead.`,
9701
- fixes: [{
9702
- fixName: "unnecessaryFailYieldableError_fix",
9703
- description: "Replace yield* Effect.fail with yield*",
9704
- apply: gen(function* () {
9705
- const changeTracker = yield* service(ChangeTracker);
9706
- changeTracker.replaceNode(
9707
- sourceFile,
9708
- callExpression,
9709
- failArgument
9710
- );
9711
- })
9712
- }]
9713
- });
9714
- }
9715
9905
  }
9906
+ return void_;
9716
9907
  }),
9717
9908
  ignore
9718
9909
  );
@@ -9725,6 +9916,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
9725
9916
  var unnecessaryPipe = createDiagnostic({
9726
9917
  name: "unnecessaryPipe",
9727
9918
  code: 9,
9919
+ description: "Removes pipe calls with no arguments",
9728
9920
  severity: "suggestion",
9729
9921
  apply: fn("unnecessaryPipe.apply")(function* (sourceFile, report) {
9730
9922
  const ts = yield* service(TypeScriptApi);
@@ -9770,6 +9962,7 @@ var unnecessaryPipe = createDiagnostic({
9770
9962
  var unnecessaryPipeChain = createDiagnostic({
9771
9963
  name: "unnecessaryPipeChain",
9772
9964
  code: 16,
9965
+ description: "Simplifies chained pipe calls into a single pipe call",
9773
9966
  severity: "suggestion",
9774
9967
  apply: fn("unnecessaryPipeChain.apply")(function* (sourceFile, report) {
9775
9968
  const ts = yield* service(TypeScriptApi);
@@ -9844,6 +10037,7 @@ var unnecessaryPipeChain = createDiagnostic({
9844
10037
  var unsupportedServiceAccessors = createDiagnostic({
9845
10038
  name: "unsupportedServiceAccessors",
9846
10039
  code: 21,
10040
+ description: "Warns about service accessors that need codegen due to generic/complex signatures",
9847
10041
  severity: "warning",
9848
10042
  apply: fn("unsupportedServiceAccessors.apply")(function* (sourceFile, report) {
9849
10043
  const ts = yield* service(TypeScriptApi);
@@ -9931,7 +10125,8 @@ var diagnostics = [
9931
10125
  unknownInEffectCatch,
9932
10126
  runEffectInsideEffect,
9933
10127
  schemaUnionOfLiterals,
9934
- schemaStructWithTag
10128
+ schemaStructWithTag,
10129
+ globalErrorInEffectFailure
9935
10130
  ];
9936
10131
 
9937
10132
  // src/completions/effectDiagnosticsComment.ts
@@ -10128,6 +10323,43 @@ var effectSelfInClasses = createCompletion({
10128
10323
  })
10129
10324
  });
10130
10325
 
10326
+ // src/completions/effectSqlModelSelfInClasses.ts
10327
+ var effectSqlModelSelfInClasses = createCompletion({
10328
+ name: "effectSqlModelSelfInClasses",
10329
+ apply: fn("effectSqlModelSelfInClasses")(function* (sourceFile, position) {
10330
+ const ts = yield* service(TypeScriptApi);
10331
+ const tsUtils = yield* service(TypeScriptUtils);
10332
+ const typeParser = yield* service(TypeParser);
10333
+ const maybeInfos = tsUtils.parseDataForExtendsClassCompletion(sourceFile, position);
10334
+ if (!maybeInfos) return [];
10335
+ const { accessedObject, className, replacementSpan } = maybeInfos;
10336
+ const schemaIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
10337
+ sourceFile,
10338
+ "@effect/sql",
10339
+ "Model"
10340
+ ) || "Model";
10341
+ const isFullyQualified = schemaIdentifier === ts.idText(accessedObject);
10342
+ const name = ts.idText(className);
10343
+ const completions2 = [];
10344
+ const hasClassCompletion = isFullyQualified || isSome2(
10345
+ yield* pipe(
10346
+ typeParser.isNodeReferenceToEffectSqlModelModuleApi("Class")(accessedObject),
10347
+ option
10348
+ )
10349
+ );
10350
+ if (hasClassCompletion) {
10351
+ completions2.push({
10352
+ name: `Class<${name}>`,
10353
+ kind: ts.ScriptElementKind.constElement,
10354
+ insertText: isFullyQualified ? `${schemaIdentifier}.Class<${name}>("${name}")({${"${0}"}}){}` : `Class<${name}>("${name}")({${"${0}"}}){}`,
10355
+ replacementSpan,
10356
+ isSnippet: true
10357
+ });
10358
+ }
10359
+ return completions2;
10360
+ })
10361
+ });
10362
+
10131
10363
  // src/completions/fnFunctionStar.ts
10132
10364
  var fnFunctionStar = createCompletion({
10133
10365
  name: "fnFunctionStar",
@@ -10184,10 +10416,12 @@ var genFunctionStar = createCompletion({
10184
10416
  const ts = yield* service(TypeScriptApi);
10185
10417
  const tsUtils = yield* service(TypeScriptUtils);
10186
10418
  const typeChecker = yield* service(TypeCheckerApi);
10419
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
10187
10420
  const maybeInfos = tsUtils.parseAccessedExpressionForCompletion(sourceFile, position);
10188
10421
  if (!maybeInfos) return [];
10189
10422
  const { accessedObject } = maybeInfos;
10190
- const type = typeChecker.getTypeAtLocation(accessedObject);
10423
+ const type = typeCheckerUtils.getTypeAtLocation(accessedObject);
10424
+ if (!type) return [];
10191
10425
  const genMemberSymbol = type.getProperty("gen");
10192
10426
  if (!genMemberSymbol) return [];
10193
10427
  const genType = typeChecker.getTypeOfSymbolAtLocation(genMemberSymbol, accessedObject);
@@ -10274,6 +10508,7 @@ var schemaBrand = createCompletion({
10274
10508
 
10275
10509
  // src/completions.ts
10276
10510
  var completions = [
10511
+ effectSqlModelSelfInClasses,
10277
10512
  effectSchemaSelfInClasses,
10278
10513
  effectSelfInClasses,
10279
10514
  contextSelfInClasses,
@@ -10909,6 +11144,7 @@ function effectRpcDefinition(applicableGotoDefinition, sourceFile, position) {
10909
11144
  const ts = yield* service(TypeScriptApi);
10910
11145
  const tsUtils = yield* service(TypeScriptUtils);
10911
11146
  const typeChecker = yield* service(TypeCheckerApi);
11147
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
10912
11148
  const textRange = tsUtils.toTextRange(position);
10913
11149
  function isSymbolFromEffectRpcModule(symbol3) {
10914
11150
  if (symbol3.valueDeclaration) {
@@ -10940,7 +11176,8 @@ function effectRpcDefinition(applicableGotoDefinition, sourceFile, position) {
10940
11176
  let callNode = null;
10941
11177
  for (const node of tsUtils.getAncestorNodesInRange(sourceFile, textRange)) {
10942
11178
  if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.name) && tsUtils.isNodeInRange(textRange)(node.name)) {
10943
- const type = typeChecker.getTypeAtLocation(node);
11179
+ const type = typeCheckerUtils.getTypeAtLocation(node);
11180
+ if (!type) return void 0;
10944
11181
  for (const callSig of typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call)) {
10945
11182
  if (callSig.parameters.length >= 2 && isSymbolFromEffectRpcClientModule(callSig.parameters[1])) {
10946
11183
  rpcName = ts.idText(node.name);
@@ -10974,11 +11211,13 @@ function effectRpcDefinition(applicableGotoDefinition, sourceFile, position) {
10974
11211
  if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && (ts.idText(node.expression.name) === "make" || ts.idText(node.expression.name) === "fromTaggedRequest")) {
10975
11212
  const symbol3 = typeChecker.getSymbolAtLocation(node.expression.name);
10976
11213
  if (symbol3 && isSymbolFromEffectRpcModule(symbol3)) {
10977
- const type = typeChecker.getTypeAtLocation(node);
10978
- const _tag = type.getProperty("_tag");
10979
- if (_tag) {
10980
- const tagValue = typeChecker.getTypeOfSymbolAtLocation(_tag, node);
10981
- if ("value" in tagValue && tagValue.value === rpcName) result.push([node, symbol3]);
11214
+ const type = typeCheckerUtils.getTypeAtLocation(node);
11215
+ if (type) {
11216
+ const _tag = type.getProperty("_tag");
11217
+ if (_tag) {
11218
+ const tagValue = typeChecker.getTypeOfSymbolAtLocation(_tag, node);
11219
+ if ("value" in tagValue && tagValue.value === rpcName) result.push([node, symbol3]);
11220
+ }
10982
11221
  }
10983
11222
  }
10984
11223
  }
@@ -11072,6 +11311,7 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
11072
11311
  gen(function* () {
11073
11312
  const ts = yield* service(TypeScriptApi);
11074
11313
  const typeChecker = yield* service(TypeCheckerApi);
11314
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
11075
11315
  const typeParser = yield* service(TypeParser);
11076
11316
  const tsUtils = yield* service(TypeScriptUtils);
11077
11317
  const options = yield* service(LanguageServicePluginOptions);
@@ -11187,13 +11427,16 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
11187
11427
  const adjustedNode = getNodeForQuickInfo(touchingNode);
11188
11428
  if (ts.isToken(adjustedNode) && adjustedNode.kind === ts.SyntaxKind.YieldKeyword) {
11189
11429
  if (ts.isYieldExpression(adjustedNode.parent) && adjustedNode.parent.asteriskToken && adjustedNode.parent.expression) {
11190
- return {
11191
- label: "Effect Type Parameters",
11192
- type: typeChecker.getTypeAtLocation(adjustedNode.parent.expression),
11193
- atLocation: adjustedNode.parent.expression,
11194
- node: adjustedNode.parent,
11195
- shouldTry: true
11196
- };
11430
+ const type3 = typeCheckerUtils.getTypeAtLocation(adjustedNode.parent.expression);
11431
+ if (type3) {
11432
+ return {
11433
+ label: "Effect Type Parameters",
11434
+ type: type3,
11435
+ atLocation: adjustedNode.parent.expression,
11436
+ node: adjustedNode.parent,
11437
+ shouldTry: true
11438
+ };
11439
+ }
11197
11440
  }
11198
11441
  }
11199
11442
  const nodeSignature = getSignatureForQuickInfo(adjustedNode);
@@ -11206,13 +11449,16 @@ function effectTypeArgs(sourceFile, position, quickInfo2) {
11206
11449
  shouldTry: options.quickinfoEffectParameters === "always" && quickInfo2 ? true : quickInfo2 && ts.displayPartsToString(quickInfo2.displayParts).indexOf("...") > -1
11207
11450
  };
11208
11451
  }
11209
- return {
11210
- label: "Effect Type Parameters",
11211
- type: typeChecker.getTypeAtLocation(adjustedNode),
11212
- atLocation: adjustedNode,
11213
- node: adjustedNode,
11214
- shouldTry: options.quickinfoEffectParameters === "always" && quickInfo2 ? true : quickInfo2 && ts.displayPartsToString(quickInfo2.displayParts).indexOf("...") > -1
11215
- };
11452
+ const type2 = typeCheckerUtils.getTypeAtLocation(adjustedNode);
11453
+ if (type2) {
11454
+ return {
11455
+ label: "Effect Type Parameters",
11456
+ type: type2,
11457
+ atLocation: adjustedNode,
11458
+ node: adjustedNode,
11459
+ shouldTry: options.quickinfoEffectParameters === "always" && quickInfo2 ? true : quickInfo2 && ts.displayPartsToString(quickInfo2.displayParts).indexOf("...") > -1
11460
+ };
11461
+ }
11216
11462
  }
11217
11463
  const data = getDataForQuickInfo();
11218
11464
  if (!(data && data.shouldTry)) return quickInfo2;
@@ -15481,7 +15727,7 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
15481
15727
  }
15482
15728
  }
15483
15729
  } else if (ts.isExpression(node2)) {
15484
- layerType = typeChecker.getTypeAtLocation(node2);
15730
+ layerType = typeCheckerUtils.getTypeAtLocation(node2);
15485
15731
  }
15486
15732
  if (layerType) {
15487
15733
  layerTypes = yield* pipe(typeParser.layerType(layerType, node2), orElse2(() => void_));
@@ -15997,7 +16243,7 @@ function getAdjustedNode(sourceFile, position) {
15997
16243
  return gen(function* () {
15998
16244
  const ts = yield* service(TypeScriptApi);
15999
16245
  const tsUtils = yield* service(TypeScriptUtils);
16000
- const typeChecker = yield* service(TypeCheckerApi);
16246
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
16001
16247
  const typeParser = yield* service(TypeParser);
16002
16248
  const range = tsUtils.toTextRange(position);
16003
16249
  const maybeNode = pipe(
@@ -16009,10 +16255,12 @@ function getAdjustedNode(sourceFile, position) {
16009
16255
  if (isNone2(maybeNode)) return void 0;
16010
16256
  const node = maybeNode.value;
16011
16257
  const layerNode = node.initializer ? node.initializer : node;
16012
- const layerType = typeChecker.getTypeAtLocation(layerNode);
16013
- const maybeLayer = yield* option(typeParser.layerType(layerType, layerNode));
16014
- if (isNone2(maybeLayer)) return void 0;
16015
- return { node, layerNode };
16258
+ const layerType = typeCheckerUtils.getTypeAtLocation(layerNode);
16259
+ if (layerType) {
16260
+ const maybeLayer = yield* option(typeParser.layerType(layerType, layerNode));
16261
+ if (isNone2(maybeLayer)) return void 0;
16262
+ return { node, layerNode };
16263
+ }
16016
16264
  });
16017
16265
  }
16018
16266
  function parseLayerGraph(layerNode) {
@@ -17647,15 +17895,21 @@ var processNode = (node, isVirtualTypeNode) => gen(function* () {
17647
17895
  }
17648
17896
  if (ts.isTypeQueryNode(node)) {
17649
17897
  const typeChecker = yield* service(TypeCheckerApi);
17650
- const type = typeChecker.getTypeAtLocation(node.exprName);
17651
- const typeNode = typeChecker.typeToTypeNode(type, void 0, ts.NodeBuilderFlags.NoTruncation);
17652
- if (typeNode) return yield* processNode(typeNode, true);
17898
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
17899
+ const type = typeCheckerUtils.getTypeAtLocation(node.exprName);
17900
+ if (type) {
17901
+ const typeNode = typeChecker.typeToTypeNode(type, void 0, ts.NodeBuilderFlags.NoTruncation);
17902
+ if (typeNode) return yield* processNode(typeNode, true);
17903
+ }
17653
17904
  }
17654
17905
  if (!isVirtualTypeNode && ts.isIndexedAccessTypeNode(node) && ts.isParenthesizedTypeNode(node.objectType) && ts.isTypeQueryNode(node.objectType.type) && ts.isTypeOperatorNode(node.indexType) && node.indexType.operator === ts.SyntaxKind.KeyOfKeyword && ts.isTypeQueryNode(node.indexType.type) && node.indexType.type.exprName.getText().trim() === node.objectType.type.exprName.getText().trim()) {
17655
17906
  const typeChecker = yield* service(TypeCheckerApi);
17656
- const type = typeChecker.getTypeAtLocation(node);
17657
- const typeNode = typeChecker.typeToTypeNode(type, void 0, ts.NodeBuilderFlags.NoTruncation);
17658
- if (typeNode) return yield* processNode(typeNode, true);
17907
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
17908
+ const type = typeCheckerUtils.getTypeAtLocation(node);
17909
+ if (type) {
17910
+ const typeNode = typeChecker.typeToTypeNode(type, void 0, ts.NodeBuilderFlags.NoTruncation);
17911
+ if (typeNode) return yield* processNode(typeNode, true);
17912
+ }
17659
17913
  }
17660
17914
  if (ts.isTypeReferenceNode(node)) {
17661
17915
  const parsedName = entityNameToDataTypeName(node.typeName);
@@ -17962,6 +18216,7 @@ var wrapWithEffectGen = createRefactor({
17962
18216
  const ts = yield* service(TypeScriptApi);
17963
18217
  const tsUtils = yield* service(TypeScriptUtils);
17964
18218
  const typeChecker = yield* service(TypeCheckerApi);
18219
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
17965
18220
  const typeParser = yield* service(TypeParser);
17966
18221
  const findEffectToWrap = fn("wrapWithEffectGen.apply.findEffectToWrap")(
17967
18222
  function* (node) {
@@ -17969,7 +18224,8 @@ var wrapWithEffectGen = createRefactor({
17969
18224
  if (node.parent && ts.isHeritageClause(node.parent)) return yield* fail3("is in a heritage clause");
17970
18225
  const parent = node.parent;
17971
18226
  if (parent != null && ts.isVariableDeclaration(parent) && parent.initializer !== node) return yield* fail3("is LHS of variable declaration");
17972
- const type = typeChecker.getTypeAtLocation(node);
18227
+ const type = typeCheckerUtils.getTypeAtLocation(node);
18228
+ if (!type) return yield* fail3("cannot get type");
17973
18229
  yield* typeParser.strictEffectType(type, node);
17974
18230
  return node;
17975
18231
  }