@effect/language-service 0.35.1 → 0.36.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/transform.js CHANGED
@@ -24,7 +24,7 @@ __export(transform_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(transform_exports);
26
26
 
27
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Function.js
27
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Function.js
28
28
  var isFunction = (input) => typeof input === "function";
29
29
  var dual = function(arity, body) {
30
30
  if (typeof arity === "function") {
@@ -118,7 +118,7 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
118
118
  }
119
119
  }
120
120
 
121
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/GlobalValue.js
121
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/GlobalValue.js
122
122
  var globalStoreId = `effect/GlobalValue`;
123
123
  var globalStore;
124
124
  var globalValue = (id, compute) => {
@@ -132,7 +132,7 @@ var globalValue = (id, compute) => {
132
132
  return globalStore.get(id);
133
133
  };
134
134
 
135
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Predicate.js
135
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Predicate.js
136
136
  var isString = (input) => typeof input === "string";
137
137
  var isNumber = (input) => typeof input === "number";
138
138
  var isBoolean = (input) => typeof input === "boolean";
@@ -142,7 +142,7 @@ var isObject = (input) => isRecordOrArray(input) || isFunction2(input);
142
142
  var hasProperty = /* @__PURE__ */ dual(2, (self, property) => isObject(self) && property in self);
143
143
  var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
144
144
 
145
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Utils.js
145
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Utils.js
146
146
  var GenKindTypeId = /* @__PURE__ */ Symbol.for("effect/Gen/GenKind");
147
147
  var GenKindImpl = class {
148
148
  value;
@@ -264,7 +264,7 @@ var internalCall = isNotOptimizedAway ? standard.effect_internal_function : forc
264
264
  var genConstructor = function* () {
265
265
  }.constructor;
266
266
 
267
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Hash.js
267
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Hash.js
268
268
  var randomHashCache = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/Hash/randomHashCache"), () => /* @__PURE__ */ new WeakMap());
269
269
  var symbol = /* @__PURE__ */ Symbol.for("effect/Hash");
270
270
  var hash = (self) => {
@@ -363,7 +363,7 @@ var cached = function() {
363
363
  return hash2;
364
364
  };
365
365
 
366
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Equal.js
366
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Equal.js
367
367
  var symbol2 = /* @__PURE__ */ Symbol.for("effect/Equal");
368
368
  function equals() {
369
369
  if (arguments.length === 1) {
@@ -417,7 +417,7 @@ function compareBoth(self, that) {
417
417
  var isEqual = (u) => hasProperty(u, symbol2);
418
418
  var equivalence = () => equals;
419
419
 
420
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Inspectable.js
420
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Inspectable.js
421
421
  var NodeInspectSymbol = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
422
422
  var toJSON = (x) => {
423
423
  try {
@@ -469,7 +469,7 @@ var redact = (u) => {
469
469
  return u;
470
470
  };
471
471
 
472
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Pipeable.js
472
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Pipeable.js
473
473
  var pipeArguments = (self, args2) => {
474
474
  switch (args2.length) {
475
475
  case 0:
@@ -502,14 +502,14 @@ var pipeArguments = (self, args2) => {
502
502
  }
503
503
  };
504
504
 
505
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/opCodes/effect.js
505
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/opCodes/effect.js
506
506
  var OP_COMMIT = "Commit";
507
507
 
508
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/version.js
509
- var moduleVersion = "3.17.1";
508
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/version.js
509
+ var moduleVersion = "3.17.8";
510
510
  var getCurrentVersion = () => moduleVersion;
511
511
 
512
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/effectable.js
512
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/effectable.js
513
513
  var EffectTypeId = /* @__PURE__ */ Symbol.for("effect/Effect");
514
514
  var StreamTypeId = /* @__PURE__ */ Symbol.for("effect/Stream");
515
515
  var SinkTypeId = /* @__PURE__ */ Symbol.for("effect/Sink");
@@ -596,7 +596,7 @@ var StructuralCommitPrototype = {
596
596
  ...StructuralPrototype
597
597
  };
598
598
 
599
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/option.js
599
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/option.js
600
600
  var TypeId = /* @__PURE__ */ Symbol.for("effect/Option");
601
601
  var CommonProto = {
602
602
  ...EffectPrototype,
@@ -654,7 +654,7 @@ var some = (value) => {
654
654
  return a;
655
655
  };
656
656
 
657
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/either.js
657
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/either.js
658
658
  var TypeId2 = /* @__PURE__ */ Symbol.for("effect/Either");
659
659
  var CommonProto2 = {
660
660
  ...EffectPrototype,
@@ -716,7 +716,7 @@ var right = (right3) => {
716
716
  return a;
717
717
  };
718
718
 
719
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Either.js
719
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Either.js
720
720
  var right2 = right;
721
721
  var left2 = left;
722
722
  var isLeft2 = isLeft;
@@ -724,14 +724,14 @@ var isRight2 = isRight;
724
724
  var map = /* @__PURE__ */ dual(2, (self, f) => isRight2(self) ? right2(f(self.right)) : left2(self.left));
725
725
  var getOrElse = /* @__PURE__ */ dual(2, (self, onLeft) => isLeft2(self) ? onLeft(self.left) : self.right);
726
726
 
727
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/internal/array.js
727
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/internal/array.js
728
728
  var isNonEmptyArray = (self) => self.length > 0;
729
729
 
730
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Order.js
730
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Order.js
731
731
  var make = (compare) => (self, that) => self === that ? 0 : compare(self, that);
732
732
  var string2 = /* @__PURE__ */ make((self, that) => self < that ? -1 : 1);
733
733
 
734
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Option.js
734
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Option.js
735
735
  var none2 = () => none;
736
736
  var some2 = some;
737
737
  var isNone2 = isNone;
@@ -739,7 +739,7 @@ var isSome2 = isSome;
739
739
  var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
740
740
  var fromNullable = (nullableValue) => nullableValue == null ? none2() : some2(nullableValue);
741
741
 
742
- // node_modules/.pnpm/effect@3.17.1/node_modules/effect/dist/esm/Array.js
742
+ // node_modules/.pnpm/effect@3.17.8/node_modules/effect/dist/esm/Array.js
743
743
  var fromIterable = (collection) => Array.isArray(collection) ? collection : Array.from(collection);
744
744
  var append = /* @__PURE__ */ dual(2, (self, last) => [...self, last]);
745
745
  var appendAll = /* @__PURE__ */ dual(2, (self, that) => fromIterable(self).concat(fromIterable(that)));
@@ -1247,7 +1247,7 @@ function makeTypeScriptUtils(ts) {
1247
1247
  const sourceText = sourceFile.text;
1248
1248
  let result;
1249
1249
  function find(node) {
1250
- const leading = ts.getLeadingCommentRanges(sourceText, node.getFullStart());
1250
+ const leading = ts.getLeadingCommentRanges(sourceText, node.pos);
1251
1251
  if (leading) {
1252
1252
  for (const commentRange of leading) {
1253
1253
  if (commentRange.pos <= position && position < commentRange.end) {
@@ -1256,8 +1256,8 @@ function makeTypeScriptUtils(ts) {
1256
1256
  }
1257
1257
  }
1258
1258
  }
1259
- if (node.getFullStart() <= position && position < node.getEnd()) {
1260
- node.forEachChild(find);
1259
+ if (node.pos <= position && position < node.end) {
1260
+ ts.forEachChild(node, find);
1261
1261
  }
1262
1262
  }
1263
1263
  find(sourceFile);
@@ -1276,7 +1276,7 @@ function makeTypeScriptUtils(ts) {
1276
1276
  }
1277
1277
  function findNodeAtPosition(sourceFile, position) {
1278
1278
  function find(node) {
1279
- if (position >= node.getStart() && position < node.getEnd()) {
1279
+ if (position >= ts.getTokenPosOfNode(node, sourceFile) && position < node.end) {
1280
1280
  return ts.forEachChild(node, find) || node;
1281
1281
  }
1282
1282
  return void 0;
@@ -1303,7 +1303,6 @@ function makeTypeScriptUtils(ts) {
1303
1303
  return;
1304
1304
  }
1305
1305
  const startPos = token.pos === 0 ? (ts.getShebang(sourceFile.text) || "").length : token.pos;
1306
- if (startPos === 0) return;
1307
1306
  const result = ts.forEachTrailingCommentRange(sourceFile.text, startPos, isCommentInRange, pos) || ts.forEachLeadingCommentRange(sourceFile.text, startPos, isCommentInRange, pos);
1308
1307
  return result;
1309
1308
  }
@@ -1508,23 +1507,26 @@ function makeTypeScriptUtils(ts) {
1508
1507
  let replacementSpan = ts.createTextSpan(position, 0);
1509
1508
  let outerNode = precedingToken;
1510
1509
  if (ts.isIdentifier(precedingToken) && precedingToken.parent && ts.isPropertyAccessExpression(precedingToken.parent)) {
1510
+ const spanStart = ts.getTokenPosOfNode(precedingToken.parent, sourceFile);
1511
1511
  replacementSpan = ts.createTextSpan(
1512
- precedingToken.parent.getStart(sourceFile),
1513
- precedingToken.end - precedingToken.parent.getStart(sourceFile)
1512
+ spanStart,
1513
+ precedingToken.end - spanStart
1514
1514
  );
1515
1515
  accessedObject = precedingToken.parent.expression;
1516
1516
  outerNode = precedingToken.parent;
1517
1517
  } else if (ts.isToken(precedingToken) && precedingToken.kind === ts.SyntaxKind.DotToken && ts.isPropertyAccessExpression(precedingToken.parent)) {
1518
+ const precedingTokenSpanStart = ts.getTokenPosOfNode(precedingToken.parent, sourceFile);
1518
1519
  replacementSpan = ts.createTextSpan(
1519
- precedingToken.parent.getStart(sourceFile),
1520
- precedingToken.end - precedingToken.parent.getStart(sourceFile)
1520
+ precedingTokenSpanStart,
1521
+ precedingToken.end - precedingTokenSpanStart
1521
1522
  );
1522
1523
  accessedObject = precedingToken.parent.expression;
1523
1524
  outerNode = precedingToken.parent;
1524
1525
  } else if (ts.isIdentifier(precedingToken) && precedingToken.parent) {
1526
+ const precedingTokenSpanStart = ts.getTokenPosOfNode(precedingToken, sourceFile);
1525
1527
  replacementSpan = ts.createTextSpan(
1526
- precedingToken.getStart(sourceFile),
1527
- precedingToken.end - precedingToken.getStart(sourceFile)
1528
+ precedingTokenSpanStart,
1529
+ precedingToken.end - precedingTokenSpanStart
1528
1530
  );
1529
1531
  accessedObject = precedingToken;
1530
1532
  outerNode = precedingToken;
@@ -1618,6 +1620,13 @@ function makeTypeScriptUtils(ts) {
1618
1620
  []
1619
1621
  );
1620
1622
  }
1623
+ function getSourceFileOfNode(current) {
1624
+ let node = current;
1625
+ while (node && node.kind !== ts.SyntaxKind.SourceFile) {
1626
+ node = node.parent;
1627
+ }
1628
+ return node;
1629
+ }
1621
1630
  return {
1622
1631
  findNodeAtPositionIncludingTrivia,
1623
1632
  parsePackageContentNameAndVersionFromScope,
@@ -1637,7 +1646,8 @@ function makeTypeScriptUtils(ts) {
1637
1646
  createEffectGenCallExpressionWithBlock,
1638
1647
  createReturnYieldStarStatement,
1639
1648
  makeGetModuleSpecifier,
1640
- parseAccessedExpressionForCompletion
1649
+ parseAccessedExpressionForCompletion,
1650
+ getSourceFileOfNode
1641
1651
  };
1642
1652
  }
1643
1653
 
@@ -1748,7 +1758,7 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1748
1758
  if (foundNode) {
1749
1759
  lineOverrides[ruleName] = lineOverrides[ruleName] || [];
1750
1760
  lineOverrides[ruleName].unshift({
1751
- pos: foundNode.node.getFullStart(),
1761
+ pos: foundNode.node.pos,
1752
1762
  end: foundNode.node.end,
1753
1763
  level: ruleLevel
1754
1764
  });
@@ -1787,11 +1797,12 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1787
1797
  service(ChangeTracker),
1788
1798
  (changeTracker) => gen(function* () {
1789
1799
  const disableAtNode = findParentStatementForDisableNextLine(node);
1790
- const { line } = ts.getLineAndCharacterOfPosition(sourceFile, disableAtNode.getStart());
1800
+ const start = ts.getTokenPosOfNode(disableAtNode, sourceFile);
1801
+ const { line } = ts.getLineAndCharacterOfPosition(sourceFile, start);
1791
1802
  changeTracker.insertCommentBeforeLine(
1792
1803
  sourceFile,
1793
1804
  line,
1794
- disableAtNode.getStart(),
1805
+ start,
1795
1806
  ` @effect-diagnostics-next-line ${rule.name}:off`
1796
1807
  );
1797
1808
  })
@@ -1814,8 +1825,8 @@ var createDiagnosticExecutor = fn("LSP.createCommentDirectivesProcessor")(
1814
1825
  };
1815
1826
  const applicableDiagnostics = [];
1816
1827
  yield* rule.apply(sourceFile, (entry) => {
1817
- const range = "getEnd" in entry.location ? { pos: entry.location.getStart(sourceFile), end: entry.location.getEnd() } : entry.location;
1818
- const node = "getEnd" in entry.location ? entry.location : tsUtils.findNodeAtPositionIncludingTrivia(sourceFile, entry.location.pos);
1828
+ const range = "kind" in entry.location ? { pos: ts.getTokenPosOfNode(entry.location, sourceFile), end: entry.location.end } : entry.location;
1829
+ const node = "kind" in entry.location ? entry.location : tsUtils.findNodeAtPositionIncludingTrivia(sourceFile, entry.location.pos);
1819
1830
  applicableDiagnostics.push({
1820
1831
  range,
1821
1832
  messageText: entry.messageText,
@@ -1946,29 +1957,6 @@ var deterministicTypeOrder = gen(function* () {
1946
1957
  return 0;
1947
1958
  });
1948
1959
  });
1949
- var getMissingTypeEntriesInTargetType = fn(
1950
- "TypeCheckerApi.getMissingTypeEntriesInTargetType"
1951
- )(
1952
- function* (realType, expectedType) {
1953
- if (realType === expectedType) return [];
1954
- const typeChecker = yield* service(TypeCheckerApi);
1955
- const result = [];
1956
- let toTest = [realType];
1957
- while (toTest.length > 0) {
1958
- const type = toTest.pop();
1959
- if (!type) return result;
1960
- if (type.isUnion()) {
1961
- toTest = toTest.concat(type.types);
1962
- } else {
1963
- const assignable = typeChecker.isTypeAssignableTo(type, expectedType);
1964
- if (!assignable) {
1965
- result.push(type);
1966
- }
1967
- }
1968
- }
1969
- return result;
1970
- }
1971
- );
1972
1960
  var CannotFindAncestorConvertibleDeclarationError = class {
1973
1961
  constructor(node) {
1974
1962
  this.node = node;
@@ -2002,6 +1990,7 @@ var CannotInferReturnType = class {
2002
1990
  };
2003
1991
  var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function* (declaration) {
2004
1992
  const typeChecker = yield* service(TypeCheckerApi);
1993
+ const ts = yield* service(TypeScriptApi);
2005
1994
  if (!declaration.body) {
2006
1995
  return yield* fail(
2007
1996
  new CannotInferReturnTypeFromEmptyBody(declaration)
@@ -2009,10 +1998,13 @@ var getInferredReturnType = fn("TypeCheckerApi.getInferredReturnType")(function*
2009
1998
  }
2010
1999
  let returnType;
2011
2000
  if (typeChecker.isImplementationOfOverload(declaration)) {
2012
- const signatures = typeChecker.getTypeAtLocation(declaration).getCallSignatures();
2001
+ const signatures = typeChecker.getSignaturesOfType(
2002
+ typeChecker.getTypeAtLocation(declaration),
2003
+ ts.SignatureKind.Call
2004
+ );
2013
2005
  if (signatures.length > 1) {
2014
2006
  returnType = typeChecker.getUnionType(
2015
- signatures.map((s) => s.getReturnType()).filter((_) => !!_)
2007
+ signatures.map((s) => typeChecker.getReturnTypeOfSignature(s)).filter((_) => !!_)
2016
2008
  );
2017
2009
  }
2018
2010
  }
@@ -2055,7 +2047,7 @@ var expectedAndRealType = cachedBy(
2055
2047
  } else if (ts.isCallExpression(node)) {
2056
2048
  const resolvedSignature = typeChecker.getResolvedSignature(node);
2057
2049
  if (resolvedSignature) {
2058
- resolvedSignature.getParameters().map((parameter, index) => {
2050
+ resolvedSignature.parameters.map((parameter, index) => {
2059
2051
  const expectedType = typeChecker.getTypeOfSymbolAtLocation(parameter, node);
2060
2052
  const realType = typeChecker.getTypeAtLocation(node.arguments[index]);
2061
2053
  result.push([
@@ -2074,11 +2066,14 @@ var expectedAndRealType = cachedBy(
2074
2066
  if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) {
2075
2067
  const type = typeChecker.getContextualType(parent.parent);
2076
2068
  if (type) {
2077
- const symbol3 = typeChecker.getPropertyOfType(type, node.text);
2078
- if (symbol3) {
2079
- const expectedType = typeChecker.getTypeOfSymbolAtLocation(symbol3, node);
2080
- const realType = typeChecker.getTypeAtLocation(node);
2081
- result.push([node, expectedType, node, realType]);
2069
+ const name = ts.isIdentifier(node) ? ts.idText(node) : ts.isStringLiteral(node) ? node.text : void 0;
2070
+ if (name) {
2071
+ const symbol3 = typeChecker.getPropertyOfType(type, name);
2072
+ if (symbol3) {
2073
+ const expectedType = typeChecker.getTypeOfSymbolAtLocation(symbol3, node);
2074
+ const realType = typeChecker.getTypeAtLocation(node);
2075
+ result.push([node, expectedType, node, realType]);
2076
+ }
2082
2077
  }
2083
2078
  }
2084
2079
  }
@@ -2134,82 +2129,137 @@ var expectedAndRealType = cachedBy(
2134
2129
  "TypeCheckerApi.expectedAndRealType",
2135
2130
  (sourceFile) => sourceFile
2136
2131
  );
2137
- var unrollUnionMembers = (type) => {
2138
- const result = [];
2139
- let toTest = [type];
2140
- while (toTest.length > 0) {
2141
- const type2 = toTest.pop();
2142
- if (type2.isUnion()) {
2143
- toTest = toTest.concat(type2.types);
2144
- } else {
2145
- result.push(type2);
2132
+ function makeResolveExternalModuleName(typeChecker) {
2133
+ if (!(hasProperty(typeChecker, "resolveExternalModuleName") && isFunction(typeChecker.resolveExternalModuleName))) {
2134
+ return;
2135
+ }
2136
+ const _internal = typeChecker.resolveExternalModuleName;
2137
+ return (moduleSpecifier) => {
2138
+ return _internal(moduleSpecifier);
2139
+ };
2140
+ }
2141
+
2142
+ // src/core/TypeCheckerUtils.ts
2143
+ var TypeCheckerUtils = Tag("TypeCheckerUtils");
2144
+ var nanoLayer2 = (fa) => pipe(
2145
+ service(TypeScriptApi),
2146
+ flatMap2(
2147
+ (ts) => flatMap2(service(TypeCheckerApi), (typeChecker) => pipe(fa, provideService(TypeCheckerUtils, makeTypeCheckerUtils(ts, typeChecker))))
2148
+ )
2149
+ );
2150
+ function makeTypeCheckerUtils(ts, typeChecker) {
2151
+ function isUnion(type) {
2152
+ return !!(type.flags & ts.TypeFlags.Union);
2153
+ }
2154
+ function isIndexType(type) {
2155
+ return !!(type.flags & ts.TypeFlags.Index);
2156
+ }
2157
+ function isThisTypeParameter(type) {
2158
+ return !!(type.flags & ts.TypeFlags.TypeParameter && type.isThisType);
2159
+ }
2160
+ function getTypeParameterAtPosition(signature, pos) {
2161
+ const type = typeChecker.getParameterType(signature, pos);
2162
+ if (isIndexType(type) && isThisTypeParameter(type.type)) {
2163
+ const constraint = typeChecker.getBaseConstraintOfType(type.type);
2164
+ if (constraint) {
2165
+ return typeChecker.getIndexType(constraint);
2166
+ }
2146
2167
  }
2168
+ return type;
2147
2169
  }
2148
- return result;
2149
- };
2150
- var appendToUniqueTypesMap = fn(
2151
- "TypeCheckerApi.appendToUniqueTypesMap"
2152
- )(
2153
- function* (memory, initialType, shouldExclude) {
2154
- const typeChecker = yield* service(TypeCheckerApi);
2155
- const newIndexes = /* @__PURE__ */ new Set();
2156
- const knownIndexes = /* @__PURE__ */ new Set();
2157
- let toTest = [initialType];
2170
+ const unrollUnionMembers = (type) => {
2171
+ const result = [];
2172
+ let toTest = [type];
2158
2173
  while (toTest.length > 0) {
2159
- const type = toTest.pop();
2160
- if (!type) break;
2161
- if (yield* shouldExclude(type)) {
2162
- continue;
2174
+ const type2 = toTest.pop();
2175
+ if (isUnion(type2)) {
2176
+ toTest = toTest.concat(type2.types);
2177
+ } else {
2178
+ result.push(type2);
2163
2179
  }
2164
- if (type.isUnion()) {
2180
+ }
2181
+ return result;
2182
+ };
2183
+ const getMissingTypeEntriesInTargetType = function(realType, expectedType) {
2184
+ if (realType === expectedType) return [];
2185
+ const result = [];
2186
+ let toTest = [realType];
2187
+ while (toTest.length > 0) {
2188
+ const type = toTest.pop();
2189
+ if (!type) return result;
2190
+ if (isUnion(type)) {
2165
2191
  toTest = toTest.concat(type.types);
2166
2192
  } else {
2167
- const foundMatch = [];
2168
- for (const [typeId, knownType] of memory.entries()) {
2169
- const areSame = typeChecker.isTypeAssignableTo(knownType, type) && typeChecker.isTypeAssignableTo(type, knownType);
2170
- if (areSame) {
2171
- foundMatch.push(typeId);
2172
- break;
2173
- }
2193
+ const assignable = typeChecker.isTypeAssignableTo(type, expectedType);
2194
+ if (!assignable) {
2195
+ result.push(type);
2174
2196
  }
2175
- if (foundMatch.length === 0) {
2176
- const newId = "t" + (memory.size + 1);
2177
- memory.set(newId, type);
2178
- newIndexes.add(newId);
2197
+ }
2198
+ }
2199
+ return result;
2200
+ };
2201
+ const appendToUniqueTypesMap = fn(
2202
+ "TypeCheckerUtils.appendToUniqueTypesMap"
2203
+ )(
2204
+ function* (memory, initialType, shouldExclude) {
2205
+ const newIndexes = /* @__PURE__ */ new Set();
2206
+ const knownIndexes = /* @__PURE__ */ new Set();
2207
+ let toTest = [initialType];
2208
+ while (toTest.length > 0) {
2209
+ const type = toTest.pop();
2210
+ if (!type) break;
2211
+ if (yield* shouldExclude(type)) {
2212
+ continue;
2213
+ }
2214
+ if (isUnion(type)) {
2215
+ toTest = toTest.concat(type.types);
2179
2216
  } else {
2180
- knownIndexes.add(foundMatch[0]);
2217
+ const foundMatch = [];
2218
+ for (const [typeId, knownType] of memory.entries()) {
2219
+ const areSame = typeChecker.isTypeAssignableTo(knownType, type) && typeChecker.isTypeAssignableTo(type, knownType);
2220
+ if (areSame) {
2221
+ foundMatch.push(typeId);
2222
+ break;
2223
+ }
2224
+ }
2225
+ if (foundMatch.length === 0) {
2226
+ const newId = "t" + (memory.size + 1);
2227
+ memory.set(newId, type);
2228
+ newIndexes.add(newId);
2229
+ } else {
2230
+ knownIndexes.add(foundMatch[0]);
2231
+ }
2181
2232
  }
2182
2233
  }
2234
+ return {
2235
+ newIndexes,
2236
+ knownIndexes,
2237
+ allIndexes: pipe(
2238
+ fromIterable(newIndexes),
2239
+ appendAll(fromIterable(knownIndexes))
2240
+ )
2241
+ };
2183
2242
  }
2184
- return {
2185
- newIndexes,
2186
- knownIndexes,
2187
- allIndexes: pipe(
2188
- fromIterable(newIndexes),
2189
- appendAll(fromIterable(knownIndexes))
2190
- )
2191
- };
2192
- }
2193
- );
2194
- function makeResolveExternalModuleName(typeChecker) {
2195
- if (!(hasProperty(typeChecker, "resolveExternalModuleName") && isFunction(typeChecker.resolveExternalModuleName))) {
2196
- return;
2197
- }
2198
- const _internal = typeChecker.resolveExternalModuleName;
2199
- return (moduleSpecifier) => {
2200
- return _internal(moduleSpecifier);
2243
+ );
2244
+ return {
2245
+ isUnion,
2246
+ getTypeParameterAtPosition,
2247
+ getMissingTypeEntriesInTargetType,
2248
+ unrollUnionMembers,
2249
+ appendToUniqueTypesMap
2201
2250
  };
2202
2251
  }
2203
2252
 
2204
2253
  // src/core/TypeParser.ts
2205
2254
  var TypeParser = Tag("@effect/language-service/TypeParser");
2206
- var nanoLayer2 = (fa) => gen(function* () {
2255
+ var nanoLayer3 = (fa) => gen(function* () {
2207
2256
  const ts = yield* service(TypeScriptApi);
2208
2257
  const tsUtils = yield* service(TypeScriptUtils);
2209
2258
  const typeChecker = yield* service(TypeCheckerApi);
2259
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
2210
2260
  return yield* pipe(
2211
2261
  fa,
2212
- provideService(TypeParser, make2(ts, tsUtils, typeChecker))
2262
+ provideService(TypeParser, make2(ts, tsUtils, typeChecker, typeCheckerUtils))
2213
2263
  );
2214
2264
  });
2215
2265
  var TypeParserIssue = class _TypeParserIssue {
@@ -2219,27 +2269,27 @@ var TypeParserIssue = class _TypeParserIssue {
2219
2269
  function typeParserIssue(_message, _type, _node) {
2220
2270
  return TypeParserIssue.issue;
2221
2271
  }
2222
- function make2(ts, tsUtils, typeChecker) {
2272
+ function make2(ts, tsUtils, typeChecker, typeCheckerUtils) {
2223
2273
  function covariantTypeArgument(type) {
2224
- const signatures = type.getCallSignatures();
2274
+ const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
2225
2275
  if (signatures.length !== 1) {
2226
2276
  return typeParserIssue("Covariant type has no call signature", type);
2227
2277
  }
2228
- return succeed(signatures[0].getReturnType());
2278
+ return succeed(typeChecker.getReturnTypeOfSignature(signatures[0]));
2229
2279
  }
2230
2280
  function contravariantTypeArgument(type) {
2231
- const signatures = type.getCallSignatures();
2281
+ const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
2232
2282
  if (signatures.length !== 1) {
2233
2283
  return typeParserIssue("Contravariant type has no call signature", type);
2234
2284
  }
2235
- return succeed(signatures[0].getTypeParameterAtPosition(0));
2285
+ return succeed(typeCheckerUtils.getTypeParameterAtPosition(signatures[0], 0));
2236
2286
  }
2237
2287
  function invariantTypeArgument(type) {
2238
- const signatures = type.getCallSignatures();
2288
+ const signatures = typeChecker.getSignaturesOfType(type, ts.SignatureKind.Call);
2239
2289
  if (signatures.length !== 1) {
2240
2290
  return typeParserIssue("Invariant type has no call signature", type);
2241
2291
  }
2242
- return succeed(signatures[0].getReturnType());
2292
+ return succeed(typeChecker.getReturnTypeOfSignature(signatures[0]));
2243
2293
  }
2244
2294
  const pipeableType = cachedBy(
2245
2295
  function(type, atLocation) {
@@ -2248,7 +2298,7 @@ function make2(ts, tsUtils, typeChecker) {
2248
2298
  return typeParserIssue("Type has no 'pipe' property", type, atLocation);
2249
2299
  }
2250
2300
  const pipeType = typeChecker.getTypeOfSymbolAtLocation(pipeSymbol, atLocation);
2251
- const signatures = pipeType.getCallSignatures();
2301
+ const signatures = typeChecker.getSignaturesOfType(pipeType, ts.SignatureKind.Call);
2252
2302
  if (signatures.length === 0) {
2253
2303
  return typeParserIssue("'pipe' property is not callable", type, atLocation);
2254
2304
  }
@@ -2303,7 +2353,9 @@ function make2(ts, tsUtils, typeChecker) {
2303
2353
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
2304
2354
  (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration && ts.isPropertySignature(_.valueDeclaration) && ts.isComputedPropertyName(_.valueDeclaration.name)
2305
2355
  );
2306
- propertiesSymbols.sort((a, b) => b.name.indexOf("EffectTypeId") - a.name.indexOf("EffectTypeId"));
2356
+ propertiesSymbols.sort(
2357
+ (a, b) => ts.symbolName(b).indexOf("EffectTypeId") - ts.symbolName(a).indexOf("EffectTypeId")
2358
+ );
2307
2359
  for (const propertySymbol of propertiesSymbols) {
2308
2360
  const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
2309
2361
  result = pipe(result, orElse2(() => effectVarianceStruct(propertyType, atLocation)));
@@ -2315,7 +2367,7 @@ function make2(ts, tsUtils, typeChecker) {
2315
2367
  );
2316
2368
  const strictEffectType = cachedBy(
2317
2369
  fn("TypeParser.strictEffectType")(function* (type, atLocation) {
2318
- if (!(type.symbol && type.symbol.name === "Effect" && !type.aliasSymbol)) {
2370
+ if (!(type.symbol && ts.symbolName(type.symbol) === "Effect" && !type.aliasSymbol)) {
2319
2371
  return yield* typeParserIssue("Type name should be Effect with no alias symbol", type, atLocation);
2320
2372
  }
2321
2373
  return yield* effectType(type, atLocation);
@@ -2329,7 +2381,9 @@ function make2(ts, tsUtils, typeChecker) {
2329
2381
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
2330
2382
  (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration && ts.isPropertySignature(_.valueDeclaration) && ts.isComputedPropertyName(_.valueDeclaration.name)
2331
2383
  );
2332
- propertiesSymbols.sort((a, b) => b.name.indexOf("LayerTypeId") - a.name.indexOf("LayerTypeId"));
2384
+ propertiesSymbols.sort(
2385
+ (a, b) => ts.symbolName(b).indexOf("LayerTypeId") - ts.symbolName(a).indexOf("LayerTypeId")
2386
+ );
2333
2387
  for (const propertySymbol of propertiesSymbols) {
2334
2388
  const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
2335
2389
  const varianceArgs = yield* option(layerVarianceStruct(
@@ -2639,7 +2693,7 @@ function make2(ts, tsUtils, typeChecker) {
2639
2693
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
2640
2694
  (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration && ts.isPropertySignature(_.valueDeclaration) && ts.isComputedPropertyName(_.valueDeclaration.name)
2641
2695
  );
2642
- propertiesSymbols.sort((a, b) => b.name.indexOf("TypeId") - a.name.indexOf("TypeId"));
2696
+ propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
2643
2697
  for (const propertySymbol of propertiesSymbols) {
2644
2698
  const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
2645
2699
  const varianceArgs = yield* option(effectSchemaVarianceStruct(
@@ -2668,7 +2722,7 @@ function make2(ts, tsUtils, typeChecker) {
2668
2722
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
2669
2723
  (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration && ts.isPropertySignature(_.valueDeclaration) && ts.isComputedPropertyName(_.valueDeclaration.name)
2670
2724
  );
2671
- propertiesSymbols.sort((a, b) => b.name.indexOf("TypeId") - a.name.indexOf("TypeId"));
2725
+ propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
2672
2726
  for (const propertySymbol of propertiesSymbols) {
2673
2727
  const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
2674
2728
  const varianceArgs = yield* option(contextTagVarianceStruct(
@@ -2686,7 +2740,7 @@ function make2(ts, tsUtils, typeChecker) {
2686
2740
  );
2687
2741
  const pipeCall = cachedBy(
2688
2742
  function(node) {
2689
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && node.expression.name.text === "pipe") {
2743
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "pipe") {
2690
2744
  return succeed({
2691
2745
  node,
2692
2746
  subject: node.expression.expression,
@@ -2709,11 +2763,13 @@ function make2(ts, tsUtils, typeChecker) {
2709
2763
  const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
2710
2764
  (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration && ts.isPropertySignature(_.valueDeclaration) && ts.isComputedPropertyName(_.valueDeclaration.name)
2711
2765
  );
2712
- propertiesSymbols.sort((a, b) => b.name.indexOf("ScopeTypeId") - a.name.indexOf("ScopeTypeId"));
2766
+ propertiesSymbols.sort(
2767
+ (a, b) => ts.symbolName(b).indexOf("ScopeTypeId") - ts.symbolName(a).indexOf("ScopeTypeId")
2768
+ );
2713
2769
  for (const propertySymbol of propertiesSymbols) {
2714
2770
  const computedPropertyExpression = propertySymbol.valueDeclaration.name;
2715
2771
  const symbol3 = typeChecker.getSymbolAtLocation(computedPropertyExpression.expression);
2716
- if (symbol3 && symbol3.name === "ScopeTypeId") {
2772
+ if (symbol3 && ts.symbolName(symbol3) === "ScopeTypeId") {
2717
2773
  return type;
2718
2774
  }
2719
2775
  }
@@ -2728,19 +2784,19 @@ function make2(ts, tsUtils, typeChecker) {
2728
2784
  if (!thenProperty) return typeParserIssue("not a promise - missing then property", type, atLocation);
2729
2785
  const thenType = typeChecker.getTypeOfSymbolAtLocation(thenProperty, atLocation);
2730
2786
  if (!thenType) return typeParserIssue("not a promise - missing then property", type, atLocation);
2731
- for (const callSignature of thenType.getCallSignatures()) {
2787
+ for (const callSignature of typeChecker.getSignaturesOfType(thenType, ts.SignatureKind.Call)) {
2732
2788
  const parameter = callSignature.parameters[0];
2733
2789
  if (!parameter) continue;
2734
- const parameterType = callSignature.getTypeParameterAtPosition(0);
2790
+ const parameterType = typeCheckerUtils.getTypeParameterAtPosition(callSignature, 0);
2735
2791
  if (!parameterType) continue;
2736
2792
  let callbackCallSignatures = [];
2737
2793
  let toTest = [parameterType];
2738
2794
  while (toTest.length > 0) {
2739
2795
  const type2 = toTest.shift();
2740
2796
  if (!type2) continue;
2741
- const callSignatures = type2.getCallSignatures();
2797
+ const callSignatures = typeChecker.getSignaturesOfType(type2, ts.SignatureKind.Call);
2742
2798
  callbackCallSignatures = callbackCallSignatures.concat(callSignatures);
2743
- if (type2.isUnion()) {
2799
+ if (typeCheckerUtils.isUnion(type2)) {
2744
2800
  toTest = toTest.concat(type2.types);
2745
2801
  }
2746
2802
  }
@@ -2749,7 +2805,7 @@ function make2(ts, tsUtils, typeChecker) {
2749
2805
  if (!callbackParameter) {
2750
2806
  continue;
2751
2807
  }
2752
- const callbackParameterType = callableType.getTypeParameterAtPosition(0);
2808
+ const callbackParameterType = typeCheckerUtils.getTypeParameterAtPosition(callableType, 0);
2753
2809
  if (!callbackParameterType) {
2754
2810
  continue;
2755
2811
  }
@@ -2781,7 +2837,7 @@ function make2(ts, tsUtils, typeChecker) {
2781
2837
  if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
2782
2838
  const selfTypeNode = schemaCall.typeArguments[0];
2783
2839
  const schemaIdentifier = schemaCall.expression;
2784
- if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "Class") {
2840
+ if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && ts.idText(schemaIdentifier.name) === "Class") {
2785
2841
  const parsedSchemaModule = yield* pipe(
2786
2842
  importedSchemaModule(schemaIdentifier.expression),
2787
2843
  option
@@ -2818,24 +2874,21 @@ function make2(ts, tsUtils, typeChecker) {
2818
2874
  if (ts.isExpressionWithTypeArguments(typeX)) {
2819
2875
  const expression = typeX.expression;
2820
2876
  if (ts.isCallExpression(expression)) {
2821
- const tagCall = expression.expression;
2822
- if (ts.isCallExpression(tagCall)) {
2823
- const schemaCall = tagCall.expression;
2824
- if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
2825
- const selfTypeNode = schemaCall.typeArguments[0];
2826
- const schemaIdentifier = schemaCall.expression;
2827
- if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedClass") {
2828
- const parsedSchemaModule = yield* pipe(
2829
- importedSchemaModule(schemaIdentifier.expression),
2830
- option
2831
- );
2832
- if (isSome2(parsedSchemaModule)) {
2833
- return {
2834
- className: atLocation.name,
2835
- selfTypeNode,
2836
- Schema: parsedSchemaModule.value
2837
- };
2838
- }
2877
+ const schemaTaggedClassTCall = expression.expression;
2878
+ if (ts.isCallExpression(schemaTaggedClassTCall) && schemaTaggedClassTCall.typeArguments && schemaTaggedClassTCall.typeArguments.length > 0) {
2879
+ const selfTypeNode = schemaTaggedClassTCall.typeArguments[0];
2880
+ const schemaIdentifier = schemaTaggedClassTCall.expression;
2881
+ if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && ts.idText(schemaIdentifier.name) === "TaggedClass") {
2882
+ const parsedSchemaModule = yield* pipe(
2883
+ importedSchemaModule(schemaIdentifier.expression),
2884
+ option
2885
+ );
2886
+ if (isSome2(parsedSchemaModule)) {
2887
+ return {
2888
+ className: atLocation.name,
2889
+ selfTypeNode,
2890
+ Schema: parsedSchemaModule.value
2891
+ };
2839
2892
  }
2840
2893
  }
2841
2894
  }
@@ -2862,24 +2915,21 @@ function make2(ts, tsUtils, typeChecker) {
2862
2915
  if (ts.isExpressionWithTypeArguments(typeX)) {
2863
2916
  const expression = typeX.expression;
2864
2917
  if (ts.isCallExpression(expression)) {
2865
- const tagCall = expression.expression;
2866
- if (ts.isCallExpression(tagCall)) {
2867
- const schemaCall = tagCall.expression;
2868
- if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
2869
- const selfTypeNode = schemaCall.typeArguments[0];
2870
- const schemaIdentifier = schemaCall.expression;
2871
- if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedError") {
2872
- const parsedSchemaModule = yield* pipe(
2873
- importedSchemaModule(schemaIdentifier.expression),
2874
- option
2875
- );
2876
- if (isSome2(parsedSchemaModule)) {
2877
- return {
2878
- className: atLocation.name,
2879
- selfTypeNode,
2880
- Schema: parsedSchemaModule.value
2881
- };
2882
- }
2918
+ const schemaTaggedErrorTCall = expression.expression;
2919
+ if (ts.isCallExpression(schemaTaggedErrorTCall) && schemaTaggedErrorTCall.typeArguments && schemaTaggedErrorTCall.typeArguments.length > 0) {
2920
+ const selfTypeNode = schemaTaggedErrorTCall.typeArguments[0];
2921
+ const schemaIdentifier = schemaTaggedErrorTCall.expression;
2922
+ if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && ts.idText(schemaIdentifier.name) === "TaggedError") {
2923
+ const parsedSchemaModule = yield* pipe(
2924
+ importedSchemaModule(schemaIdentifier.expression),
2925
+ option
2926
+ );
2927
+ if (isSome2(parsedSchemaModule)) {
2928
+ return {
2929
+ className: atLocation.name,
2930
+ selfTypeNode,
2931
+ Schema: parsedSchemaModule.value
2932
+ };
2883
2933
  }
2884
2934
  }
2885
2935
  }
@@ -2906,24 +2956,21 @@ function make2(ts, tsUtils, typeChecker) {
2906
2956
  if (ts.isExpressionWithTypeArguments(typeX)) {
2907
2957
  const expression = typeX.expression;
2908
2958
  if (ts.isCallExpression(expression)) {
2909
- const tagCall = expression.expression;
2910
- if (ts.isCallExpression(tagCall)) {
2911
- const schemaCall = tagCall.expression;
2912
- if (ts.isCallExpression(schemaCall) && schemaCall.typeArguments && schemaCall.typeArguments.length > 0) {
2913
- const selfTypeNode = schemaCall.typeArguments[0];
2914
- const schemaIdentifier = schemaCall.expression;
2915
- if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && schemaIdentifier.name.text === "TaggedRequest") {
2916
- const parsedSchemaModule = yield* pipe(
2917
- importedSchemaModule(schemaIdentifier.expression),
2918
- option
2919
- );
2920
- if (isSome2(parsedSchemaModule)) {
2921
- return {
2922
- className: atLocation.name,
2923
- selfTypeNode,
2924
- Schema: parsedSchemaModule.value
2925
- };
2926
- }
2959
+ const schemaTaggedRequestTCall = expression.expression;
2960
+ if (ts.isCallExpression(schemaTaggedRequestTCall) && schemaTaggedRequestTCall.typeArguments && schemaTaggedRequestTCall.typeArguments.length > 0) {
2961
+ const selfTypeNode = schemaTaggedRequestTCall.typeArguments[0];
2962
+ const schemaIdentifier = schemaTaggedRequestTCall.expression;
2963
+ if (ts.isPropertyAccessExpression(schemaIdentifier) && ts.isIdentifier(schemaIdentifier.name) && ts.idText(schemaIdentifier.name) === "TaggedRequest") {
2964
+ const parsedSchemaModule = yield* pipe(
2965
+ importedSchemaModule(schemaIdentifier.expression),
2966
+ option
2967
+ );
2968
+ if (isSome2(parsedSchemaModule)) {
2969
+ return {
2970
+ className: atLocation.name,
2971
+ selfTypeNode,
2972
+ Schema: parsedSchemaModule.value
2973
+ };
2927
2974
  }
2928
2975
  }
2929
2976
  }
@@ -2957,7 +3004,7 @@ function make2(ts, tsUtils, typeChecker) {
2957
3004
  if (ts.isCallExpression(contextTagCall) && wholeCall.typeArguments && wholeCall.typeArguments.length > 0) {
2958
3005
  const contextTagIdentifier = contextTagCall.expression;
2959
3006
  const selfTypeNode = wholeCall.typeArguments[0];
2960
- if (ts.isPropertyAccessExpression(contextTagIdentifier) && ts.isIdentifier(contextTagIdentifier.name) && contextTagIdentifier.name.text === "Tag") {
3007
+ if (ts.isPropertyAccessExpression(contextTagIdentifier) && ts.isIdentifier(contextTagIdentifier.name) && ts.idText(contextTagIdentifier.name) === "Tag") {
2961
3008
  const parsedContextModule = yield* pipe(
2962
3009
  importedContextModule(contextTagIdentifier.expression),
2963
3010
  option
@@ -3004,7 +3051,7 @@ function make2(ts, tsUtils, typeChecker) {
3004
3051
  if (ts.isCallExpression(effectServiceCall) && effectServiceCall.typeArguments && effectServiceCall.typeArguments.length > 0) {
3005
3052
  const effectServiceIdentifier = effectServiceCall.expression;
3006
3053
  const selfTypeNode = effectServiceCall.typeArguments[0];
3007
- if (ts.isPropertyAccessExpression(effectServiceIdentifier) && ts.isIdentifier(effectServiceIdentifier.name) && effectServiceIdentifier.name.text === "Service") {
3054
+ if (ts.isPropertyAccessExpression(effectServiceIdentifier) && ts.isIdentifier(effectServiceIdentifier.name) && ts.idText(effectServiceIdentifier.name) === "Service") {
3008
3055
  const parsedContextTag = yield* pipe(
3009
3056
  importedEffectModule(effectServiceIdentifier.expression),
3010
3057
  flatMap2(() => contextTag(type, atLocation)),
@@ -3017,10 +3064,10 @@ function make2(ts, tsUtils, typeChecker) {
3017
3064
  const args2 = wholeCall.arguments[1];
3018
3065
  if (ts.isObjectLiteralExpression(args2)) {
3019
3066
  for (const property of args2.properties) {
3020
- if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && property.name.text === "accessors" && property.initializer && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
3067
+ if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && ts.idText(property.name) === "accessors" && property.initializer && property.initializer.kind === ts.SyntaxKind.TrueKeyword) {
3021
3068
  accessors2 = true;
3022
3069
  }
3023
- if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && property.name.text === "dependencies" && property.initializer && ts.isArrayLiteralExpression(property.initializer)) {
3070
+ if (ts.isPropertyAssignment(property) && property.name && ts.isIdentifier(property.name) && ts.idText(property.name) === "dependencies" && property.initializer && ts.isArrayLiteralExpression(property.initializer)) {
3024
3071
  dependencies = property.initializer.elements;
3025
3072
  }
3026
3073
  }
@@ -3104,12 +3151,12 @@ var classSelfMismatch = createDiagnostic({
3104
3151
  let actualName = "";
3105
3152
  if (ts.isTypeReferenceNode(selfTypeNode)) {
3106
3153
  if (ts.isIdentifier(selfTypeNode.typeName)) {
3107
- actualName = selfTypeNode.typeName.text;
3154
+ actualName = ts.idText(selfTypeNode.typeName);
3108
3155
  } else if (ts.isQualifiedName(selfTypeNode.typeName)) {
3109
- actualName = selfTypeNode.typeName.right.text;
3156
+ actualName = ts.idText(selfTypeNode.typeName.right);
3110
3157
  }
3111
3158
  }
3112
- const expectedName = className.text;
3159
+ const expectedName = ts.idText(className);
3113
3160
  if (actualName !== expectedName) {
3114
3161
  report({
3115
3162
  location: selfTypeNode,
@@ -3194,11 +3241,12 @@ var effectInVoidSuccess = createDiagnostic({
3194
3241
  const ts = yield* service(TypeScriptApi);
3195
3242
  const typeChecker = yield* service(TypeCheckerApi);
3196
3243
  const typeParser = yield* service(TypeParser);
3244
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
3197
3245
  const checkForEffectInVoid = fn("effectInVoidSuccess.checkForEffectInVoid")(function* (node, expectedType, valueNode, realType) {
3198
3246
  const expectedEffect = yield* typeParser.effectType(expectedType, node);
3199
3247
  const realEffect = yield* typeParser.effectType(realType, valueNode);
3200
3248
  if (expectedEffect.A.flags & ts.TypeFlags.Void) {
3201
- const voidValueTypes = unrollUnionMembers(realEffect.A);
3249
+ const voidValueTypes = typeCheckerUtils.unrollUnionMembers(realEffect.A);
3202
3250
  const voidedEffect = yield* firstSuccessOf(
3203
3251
  voidValueTypes.map((_) => map3(typeParser.strictEffectType(_, node), () => _))
3204
3252
  );
@@ -3360,12 +3408,14 @@ var importFromBarrel = createDiagnostic({
3360
3408
  const moduleSymbol = resolveExternalModuleName(importDeclaration.moduleSpecifier);
3361
3409
  if (!moduleSymbol) return;
3362
3410
  if (!moduleSymbol.exports) return;
3363
- const sourceFile2 = importDeclaration.getSourceFile();
3411
+ const sourceFile2 = tsUtils.getSourceFileOfNode(importDeclaration);
3412
+ if (!sourceFile2) return;
3364
3413
  const nodeForSymbol = element.propertyName || element.name;
3365
3414
  const aliasSymbol = element.name || element.propertyName;
3366
- const aliasedName = aliasSymbol.text;
3415
+ const aliasedName = ts.idText(aliasSymbol);
3367
3416
  if (!ts.isIdentifier(nodeForSymbol)) return;
3368
- const importedName = nodeForSymbol.text;
3417
+ const importedName = ts.idText(nodeForSymbol);
3418
+ if (!importedName) return;
3369
3419
  const reexportedSymbol = moduleSymbol.exports.get(ts.escapeLeadingUnderscores(importedName));
3370
3420
  if (!reexportedSymbol) return;
3371
3421
  if (!(reexportedSymbol.declarations && reexportedSymbol.declarations.length === 1)) return;
@@ -3377,7 +3427,8 @@ var importFromBarrel = createDiagnostic({
3377
3427
  const originalModuleSymbol = resolveExternalModuleName(exportDeclaration.moduleSpecifier);
3378
3428
  if (!originalModuleSymbol) return;
3379
3429
  if (!originalModuleSymbol.valueDeclaration) return;
3380
- const originalSourceFile = originalModuleSymbol.valueDeclaration.getSourceFile();
3430
+ const originalSourceFile = tsUtils.getSourceFileOfNode(originalModuleSymbol.valueDeclaration);
3431
+ if (!originalSourceFile) return;
3381
3432
  const unbarrelledFileName = getModuleSpecifier(
3382
3433
  program.getCompilerOptions(),
3383
3434
  sourceFile2,
@@ -3470,6 +3521,7 @@ var leakingRequirements = createDiagnostic({
3470
3521
  apply: fn("leakingRequirements.apply")(function* (sourceFile, report) {
3471
3522
  const ts = yield* service(TypeScriptApi);
3472
3523
  const typeChecker = yield* service(TypeCheckerApi);
3524
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
3473
3525
  const typeParser = yield* service(TypeParser);
3474
3526
  const typeOrder = yield* deterministicTypeOrder;
3475
3527
  const parseLeakedRequirements = cachedBy(
@@ -3487,10 +3539,16 @@ var leakingRequirements = createDiagnostic({
3487
3539
  typeParser.effectType(servicePropertyType, atLocation),
3488
3540
  map3((_) => effectContextType = _.R),
3489
3541
  orElse2(() => {
3490
- const servicePropertyCallSignatures = servicePropertyType.getCallSignatures();
3542
+ const servicePropertyCallSignatures = typeChecker.getSignaturesOfType(
3543
+ servicePropertyType,
3544
+ ts.SignatureKind.Call
3545
+ );
3491
3546
  if (servicePropertyCallSignatures.length === 1) {
3492
3547
  return pipe(
3493
- typeParser.effectType(servicePropertyCallSignatures[0].getReturnType(), atLocation),
3548
+ typeParser.effectType(
3549
+ typeChecker.getReturnTypeOfSignature(servicePropertyCallSignatures[0]),
3550
+ atLocation
3551
+ ),
3494
3552
  map3((_) => {
3495
3553
  effectContextType = _.R;
3496
3554
  })
@@ -3502,7 +3560,7 @@ var leakingRequirements = createDiagnostic({
3502
3560
  );
3503
3561
  if (effectContextType) {
3504
3562
  effectMembers++;
3505
- const { allIndexes } = yield* appendToUniqueTypesMap(
3563
+ const { allIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
3506
3564
  memory,
3507
3565
  effectContextType,
3508
3566
  (type) => {
@@ -3550,7 +3608,7 @@ More info at https://effect.website/docs/requirements-management/layers/#avoidin
3550
3608
  while (nodeToVisit.length > 0) {
3551
3609
  const node = nodeToVisit.shift();
3552
3610
  const typesToCheck = [];
3553
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && node.expression.name.text === "GenericTag") {
3611
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "GenericTag") {
3554
3612
  typesToCheck.push([typeChecker.getTypeAtLocation(node), node]);
3555
3613
  } else if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
3556
3614
  const classSym = typeChecker.getSymbolAtLocation(node.name);
@@ -3588,13 +3646,14 @@ var missingEffectContext = createDiagnostic({
3588
3646
  const typeChecker = yield* service(TypeCheckerApi);
3589
3647
  const typeParser = yield* service(TypeParser);
3590
3648
  const typeOrder = yield* deterministicTypeOrder;
3649
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
3591
3650
  const checkForMissingContextTypes = (node, expectedType, valueNode, realType) => pipe(
3592
3651
  all(
3593
3652
  typeParser.effectType(expectedType, node),
3594
3653
  typeParser.effectType(realType, valueNode)
3595
3654
  ),
3596
- flatMap2(
3597
- ([expectedEffect, realEffect]) => getMissingTypeEntriesInTargetType(
3655
+ map3(
3656
+ ([expectedEffect, realEffect]) => typeCheckerUtils.getMissingTypeEntriesInTargetType(
3598
3657
  realEffect.R,
3599
3658
  expectedEffect.R
3600
3659
  )
@@ -3636,6 +3695,7 @@ var missingEffectError = createDiagnostic({
3636
3695
  const ts = yield* service(TypeScriptApi);
3637
3696
  const tsUtils = yield* service(TypeScriptUtils);
3638
3697
  const typeChecker = yield* service(TypeCheckerApi);
3698
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
3639
3699
  const typeParser = yield* service(TypeParser);
3640
3700
  const typeOrder = yield* deterministicTypeOrder;
3641
3701
  const effectModuleIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
@@ -3656,13 +3716,13 @@ var missingEffectError = createDiagnostic({
3656
3716
  typeParser.effectType(expectedType, node),
3657
3717
  typeParser.effectType(realType, valueNode)
3658
3718
  ),
3659
- flatMap2(
3719
+ map3(
3660
3720
  ([expectedEffect, realEffect]) => pipe(
3661
- getMissingTypeEntriesInTargetType(
3721
+ typeCheckerUtils.getMissingTypeEntriesInTargetType(
3662
3722
  realEffect.E,
3663
3723
  expectedEffect.E
3664
3724
  ),
3665
- map3((missingErrorTypes) => ({ missingErrorTypes, expectedErrorType: expectedEffect.E }))
3725
+ (missingErrorTypes) => ({ missingErrorTypes, expectedErrorType: expectedEffect.E })
3666
3726
  )
3667
3727
  )
3668
3728
  );
@@ -3686,14 +3746,18 @@ var missingEffectError = createDiagnostic({
3686
3746
  description: "Catch all errors with Effect.catchAll",
3687
3747
  apply: gen(function* () {
3688
3748
  const changeTracker = yield* service(ChangeTracker);
3689
- changeTracker.insertText(sourceFile, valueNode.getStart(), effectModuleIdentifier + ".catchAll(");
3690
- changeTracker.insertText(sourceFile, valueNode.getEnd(), ", () => ");
3749
+ changeTracker.insertText(
3750
+ sourceFile,
3751
+ ts.getTokenPosOfNode(valueNode, sourceFile),
3752
+ effectModuleIdentifier + ".catchAll("
3753
+ );
3754
+ changeTracker.insertText(sourceFile, valueNode.end, ", () => ");
3691
3755
  changeTracker.insertNodeAt(
3692
3756
  sourceFile,
3693
- valueNode.getEnd(),
3757
+ valueNode.end,
3694
3758
  createDieMessage("TODO: catchAll not implemented")
3695
3759
  );
3696
- changeTracker.insertText(sourceFile, valueNode.getEnd(), ")");
3760
+ changeTracker.insertText(sourceFile, valueNode.end, ")");
3697
3761
  })
3698
3762
  });
3699
3763
  }
@@ -3730,22 +3794,27 @@ var missingEffectError = createDiagnostic({
3730
3794
  description: "Catch unexpected errors with Effect.catchTag",
3731
3795
  apply: gen(function* () {
3732
3796
  const changeTracker = yield* service(ChangeTracker);
3733
- changeTracker.insertText(sourceFile, valueNode.getStart(), effectModuleIdentifier + ".catchTags(");
3734
- changeTracker.insertText(sourceFile, valueNode.getEnd(), ", ");
3797
+ changeTracker.insertText(
3798
+ sourceFile,
3799
+ ts.getTokenPosOfNode(valueNode, sourceFile),
3800
+ effectModuleIdentifier + ".catchTags("
3801
+ );
3802
+ changeTracker.insertText(sourceFile, valueNode.end, ", ");
3735
3803
  changeTracker.insertNodeAt(
3736
3804
  sourceFile,
3737
- valueNode.getEnd(),
3805
+ valueNode.end,
3738
3806
  ts.factory.createObjectLiteralExpression(propertyAssignments)
3739
3807
  );
3740
- changeTracker.insertText(sourceFile, valueNode.getEnd(), ")");
3808
+ changeTracker.insertText(sourceFile, valueNode.end, ")");
3741
3809
  })
3742
3810
  });
3743
3811
  }
3744
3812
  }
3813
+ const typeNames = sortTypes(result.missingErrorTypes).map((_) => typeChecker.typeToString(_));
3745
3814
  report(
3746
3815
  {
3747
3816
  location: node,
3748
- messageText: `Missing '${sortTypes(result.missingErrorTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}' in the expected Effect errors.`,
3817
+ messageText: `Missing '${typeNames.join(" | ")}' in the expected Effect errors.`,
3749
3818
  fixes
3750
3819
  }
3751
3820
  );
@@ -3765,6 +3834,7 @@ var missingEffectServiceDependency = createDiagnostic({
3765
3834
  apply: fn("missingEffectServiceDependency.apply")(function* (sourceFile, report) {
3766
3835
  const ts = yield* service(TypeScriptApi);
3767
3836
  const typeChecker = yield* service(TypeCheckerApi);
3837
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
3768
3838
  const typeParser = yield* service(TypeParser);
3769
3839
  const nodeToVisit = [];
3770
3840
  const appendNodeToVisit = (node) => {
@@ -3795,7 +3865,7 @@ var missingEffectServiceDependency = createDiagnostic({
3795
3865
  if (layerResult) {
3796
3866
  const servicesMemory = /* @__PURE__ */ new Map();
3797
3867
  const excludeNever = (type) => succeed((type.flags & ts.TypeFlags.Never) !== 0);
3798
- const { allIndexes: requiredIndexes } = yield* appendToUniqueTypesMap(
3868
+ const { allIndexes: requiredIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
3799
3869
  servicesMemory,
3800
3870
  layerResult.RIn,
3801
3871
  excludeNever
@@ -3806,8 +3876,8 @@ var missingEffectServiceDependency = createDiagnostic({
3806
3876
  let types = [];
3807
3877
  if (dependenciesProperty) {
3808
3878
  const dependenciesTypes = typeChecker.getTypeOfSymbolAtLocation(dependenciesProperty, options);
3809
- const numberIndexType = dependenciesTypes.getNumberIndexType();
3810
- types = numberIndexType ? unrollUnionMembers(numberIndexType) : [];
3879
+ const numberIndexType = typeChecker.getIndexTypeOfType(dependenciesTypes, ts.IndexKind.Number);
3880
+ types = numberIndexType ? typeCheckerUtils.unrollUnionMembers(numberIndexType) : [];
3811
3881
  }
3812
3882
  for (const depType of types) {
3813
3883
  const depLayerResult = yield* pipe(
@@ -3815,7 +3885,7 @@ var missingEffectServiceDependency = createDiagnostic({
3815
3885
  orElse2(() => void_)
3816
3886
  );
3817
3887
  if (depLayerResult) {
3818
- const { allIndexes } = yield* appendToUniqueTypesMap(
3888
+ const { allIndexes } = yield* typeCheckerUtils.appendToUniqueTypesMap(
3819
3889
  servicesMemory,
3820
3890
  depLayerResult.ROut,
3821
3891
  excludeNever
@@ -4004,7 +4074,7 @@ var multipleEffectProvide = createDiagnostic({
4004
4074
  "Layer"
4005
4075
  ) || "Layer";
4006
4076
  const parseEffectProvideLayer = (node) => {
4007
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && node.expression.name.text === "provide" && node.arguments.length > 0) {
4077
+ if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "provide" && node.arguments.length > 0) {
4008
4078
  const layer = node.arguments[0];
4009
4079
  const type = typeChecker.getTypeAtLocation(layer);
4010
4080
  return pipe(
@@ -4040,8 +4110,8 @@ var multipleEffectProvide = createDiagnostic({
4040
4110
  apply: gen(function* () {
4041
4111
  const changeTracker = yield* service(ChangeTracker);
4042
4112
  changeTracker.deleteRange(sourceFile, {
4043
- pos: chunk[0].node.getStart(sourceFile),
4044
- end: chunk[chunk.length - 1].node.getEnd()
4113
+ pos: ts.getTokenPosOfNode(chunk[0].node, sourceFile),
4114
+ end: chunk[chunk.length - 1].node.end
4045
4115
  });
4046
4116
  const newNode = ts.factory.createCallExpression(
4047
4117
  ts.factory.createPropertyAccessExpression(
@@ -4058,7 +4128,7 @@ var multipleEffectProvide = createDiagnostic({
4058
4128
  chunk.map((c) => c.layer)
4059
4129
  )]
4060
4130
  );
4061
- changeTracker.insertNodeAt(sourceFile, chunk[0].node.getStart(sourceFile), newNode);
4131
+ changeTracker.insertNodeAt(sourceFile, ts.getTokenPosOfNode(chunk[0].node, sourceFile), newNode);
4062
4132
  })
4063
4133
  }]
4064
4134
  });
@@ -4087,7 +4157,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
4087
4157
  const typeChecker = yield* service(TypeCheckerApi);
4088
4158
  const typeParser = yield* service(TypeParser);
4089
4159
  const changeTracker = yield* service(ChangeTracker);
4090
- const insertLocation = atLocation.members.length > 0 ? atLocation.members[0].pos : atLocation.getEnd() - 1;
4160
+ const insertLocation = atLocation.members.length > 0 ? atLocation.members[0].pos : atLocation.end - 1;
4091
4161
  const effectIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
4092
4162
  sourceFile,
4093
4163
  "effect",
@@ -4232,7 +4302,11 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
4232
4302
  ts.NodeBuilderFlags.NoTruncation
4233
4303
  );
4234
4304
  if (!signatureDeclaration) return yield* fail("error generating signature");
4235
- const returnType = yield* generateReturnType(signature.getReturnType(), atLocation2, className2);
4305
+ const returnType = yield* generateReturnType(
4306
+ typeChecker.getReturnTypeOfSignature(signature),
4307
+ atLocation2,
4308
+ className2
4309
+ );
4236
4310
  return ts.factory.createFunctionTypeNode(
4237
4311
  signatureDeclaration.typeParameters,
4238
4312
  signatureDeclaration.parameters,
@@ -4242,7 +4316,7 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
4242
4316
  for (const { property, propertyType } of involvedMembers) {
4243
4317
  const callSignatures = [];
4244
4318
  let propertyDeclaration = void 0;
4245
- for (const signature of propertyType.getCallSignatures()) {
4319
+ for (const signature of typeChecker.getSignaturesOfType(propertyType, ts.SignatureKind.Call)) {
4246
4320
  yield* pipe(
4247
4321
  proxySignature(signature, atLocation, className),
4248
4322
  map3((sig) => {
@@ -4253,17 +4327,18 @@ var generate = fn("writeTagClassAccessors.generate")(function* (sourceFile, serv
4253
4327
  }
4254
4328
  const allSignatures = ts.factory.createIntersectionTypeNode(callSignatures);
4255
4329
  const type = tsUtils.simplifyTypeNode(allSignatures);
4256
- propertyDeclaration = createFunctionProperty(className, property.getName(), type, callSignatures.length > 1);
4330
+ propertyDeclaration = createFunctionProperty(className, ts.symbolName(property), type, callSignatures.length > 1);
4257
4331
  const oldProperty = atLocation.members.filter(ts.isPropertyDeclaration).find((p) => {
4258
4332
  const symbol3 = typeChecker.getSymbolAtLocation(p.name);
4259
- return symbol3?.getName() === property.getName();
4333
+ return symbol3 && ts.symbolName(symbol3) === ts.symbolName(property);
4260
4334
  });
4261
4335
  if (oldProperty) {
4336
+ const start = ts.getTokenPosOfNode(oldProperty, sourceFile);
4262
4337
  changeTracker.deleteRange(sourceFile, {
4263
- pos: oldProperty.getStart(sourceFile),
4264
- end: oldProperty.getEnd()
4338
+ pos: start,
4339
+ end: oldProperty.end
4265
4340
  });
4266
- changeTracker.insertNodeAt(sourceFile, oldProperty.getStart(sourceFile), propertyDeclaration);
4341
+ changeTracker.insertNodeAt(sourceFile, start, propertyDeclaration);
4267
4342
  } else {
4268
4343
  changeTracker.insertNodeAt(sourceFile, insertLocation, propertyDeclaration, { suffix: "\n" });
4269
4344
  }
@@ -4282,14 +4357,14 @@ var parse2 = fn("writeTagClassAccessors.parse")(function* (node) {
4282
4357
  const involvedMembers = [];
4283
4358
  for (const property of typeChecker.getPropertiesOfType(Service)) {
4284
4359
  const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
4285
- const callSignatures = propertyType.getCallSignatures();
4360
+ const callSignatures = typeChecker.getSignaturesOfType(propertyType, ts.SignatureKind.Call);
4286
4361
  if (callSignatures.length > 0) {
4287
4362
  const withTypeParameters = callSignatures.filter((_) => _.typeParameters && _.typeParameters.length > 0);
4288
4363
  if (callSignatures.length > 1 || withTypeParameters.length > 0) involvedMembers.push({ property, propertyType });
4289
4364
  }
4290
4365
  }
4291
4366
  const hash2 = involvedMembers.map(({ property, propertyType }) => {
4292
- return property.getName() + ": " + typeChecker.typeToString(propertyType);
4367
+ return ts.symbolName(property) + ": " + typeChecker.typeToString(propertyType);
4293
4368
  }).concat([className.text]).join("\n");
4294
4369
  return { Service, className, atLocation: node, hash: cyrb53(hash2), involvedMembers };
4295
4370
  });
@@ -4540,6 +4615,7 @@ var scopeInLayerEffect = createDiagnostic({
4540
4615
  const tsUtils = yield* service(TypeScriptUtils);
4541
4616
  const typeChecker = yield* service(TypeCheckerApi);
4542
4617
  const typeParser = yield* service(TypeParser);
4618
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
4543
4619
  const layerModuleIdentifier = tsUtils.findImportedModuleIdentifierByPackageAndNameOrBarrel(
4544
4620
  sourceFile,
4545
4621
  "effect",
@@ -4550,22 +4626,13 @@ var scopeInLayerEffect = createDiagnostic({
4550
4626
  const expression = node.expression;
4551
4627
  if (!ts.isPropertyAccessExpression(expression)) return;
4552
4628
  const calledModule = expression.expression;
4553
- if (!(ts.isIdentifier(calledModule) && calledModule.text === layerModuleIdentifier)) return;
4629
+ if (!(ts.isIdentifier(calledModule) && ts.idText(calledModule) === layerModuleIdentifier)) return;
4554
4630
  const methodIdentifier = expression.name;
4555
- if (!(ts.isIdentifier(methodIdentifier) && methodIdentifier.text.toLowerCase().startsWith("effect"))) return;
4631
+ if (!(ts.isIdentifier(methodIdentifier) && ts.idText(methodIdentifier).toLowerCase().startsWith("effect"))) return;
4556
4632
  return { methodIdentifier };
4557
4633
  }
4558
4634
  const reportIfLayerRequireScope = (type, node, methodIdentifier) => {
4559
- let toCheck = [type];
4560
- const entries = [];
4561
- while (toCheck.length > 0) {
4562
- const type2 = toCheck.pop();
4563
- if (type2.isUnion()) {
4564
- toCheck = toCheck.concat(type2.types);
4565
- } else {
4566
- entries.push(type2);
4567
- }
4568
- }
4635
+ const entries = typeCheckerUtils.unrollUnionMembers(type);
4569
4636
  return pipe(
4570
4637
  firstSuccessOf(entries.map((type2) => typeParser.scopeType(type2, node))),
4571
4638
  map3(
@@ -4637,6 +4704,7 @@ var strictBooleanExpressions = createDiagnostic({
4637
4704
  apply: fn("strictBooleanExpressions.apply")(function* (sourceFile, report) {
4638
4705
  const ts = yield* service(TypeScriptApi);
4639
4706
  const typeChecker = yield* service(TypeCheckerApi);
4707
+ const typeCheckerUtils = yield* service(TypeCheckerUtils);
4640
4708
  const conditionChecks = /* @__PURE__ */ new WeakMap();
4641
4709
  const nodeToVisit = [];
4642
4710
  const appendNodeToVisit = (node) => {
@@ -4677,7 +4745,7 @@ var strictBooleanExpressions = createDiagnostic({
4677
4745
  let typesToCheck = [constrainedType || nodeType];
4678
4746
  while (typesToCheck.length > 0) {
4679
4747
  const type = typesToCheck.pop();
4680
- if (type.isUnion()) {
4748
+ if (typeCheckerUtils.isUnion(type)) {
4681
4749
  typesToCheck = typesToCheck.concat(type.types);
4682
4750
  continue;
4683
4751
  }
@@ -4929,15 +4997,15 @@ var unsupportedServiceAccessors = createDiagnostic({
4929
4997
  node.members?.forEach((member) => {
4930
4998
  if (ts.isPropertyDeclaration(member) && member.modifiers?.some((mod) => mod.kind === ts.SyntaxKind.StaticKeyword)) {
4931
4999
  if (member.name && ts.isIdentifier(member.name)) {
4932
- existingStaticMembers.add(member.name.text);
5000
+ existingStaticMembers.add(ts.idText(member.name));
4933
5001
  }
4934
5002
  }
4935
5003
  });
4936
5004
  const missingMembers = parseResult.involvedMembers.filter(
4937
- ({ property }) => !existingStaticMembers.has(property.getName())
5005
+ ({ property }) => !existingStaticMembers.has(ts.symbolName(property))
4938
5006
  );
4939
5007
  if (missingMembers.length > 0) {
4940
- const memberNames = missingMembers.map(({ property }) => `'${property.getName()}'`).join(", ");
5008
+ const memberNames = missingMembers.map(({ property }) => `'${ts.symbolName(property)}'`).join(", ");
4941
5009
  report({
4942
5010
  location: parseResult.className,
4943
5011
  messageText: `Even if accessors are enabled, accessors for ${memberNames} won't be available because the signature have generic type parameters or multiple call signatures.`,
@@ -4947,7 +5015,7 @@ var unsupportedServiceAccessors = createDiagnostic({
4947
5015
  apply: gen(function* () {
4948
5016
  const changeTracker = yield* service(ChangeTracker);
4949
5017
  const comment = "// @effect-codegens accessors\n";
4950
- changeTracker.insertText(sourceFile, node.getStart(sourceFile), comment);
5018
+ changeTracker.insertText(sourceFile, ts.getTokenPosOfNode(node, sourceFile), comment);
4951
5019
  })
4952
5020
  }]
4953
5021
  });
@@ -4991,6 +5059,7 @@ function transform_default(program, pluginConfig, { addDiagnostic, ts: tsInstanc
4991
5059
  return (sourceFile) => {
4992
5060
  pipe(
4993
5061
  getSemanticDiagnosticsWithCodeFixes(diagnostics, sourceFile),
5062
+ nanoLayer3,
4994
5063
  nanoLayer2,
4995
5064
  nanoLayer,
4996
5065
  provideService(TypeCheckerApi, program.getTypeChecker()),