@effect/language-service 0.58.2 → 0.58.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli.js CHANGED
@@ -30911,6 +30911,9 @@ function makeTypeScriptUtils(ts) {
30911
30911
  }
30912
30912
  return node;
30913
30913
  }
30914
+ function isDeclarationKind(kind) {
30915
+ return kind === ts.SyntaxKind.ArrowFunction || kind === ts.SyntaxKind.BindingElement || kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.ClassExpression || kind === ts.SyntaxKind.ClassStaticBlockDeclaration || kind === ts.SyntaxKind.Constructor || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.EnumMember || kind === ts.SyntaxKind.ExportSpecifier || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.FunctionExpression || kind === ts.SyntaxKind.GetAccessor || kind === ts.SyntaxKind.ImportClause || kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportSpecifier || kind === ts.SyntaxKind.InterfaceDeclaration || kind === ts.SyntaxKind.JsxAttribute || kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.MethodSignature || kind === ts.SyntaxKind.ModuleDeclaration || kind === ts.SyntaxKind.NamespaceExportDeclaration || kind === ts.SyntaxKind.NamespaceImport || kind === ts.SyntaxKind.NamespaceExport || kind === ts.SyntaxKind.Parameter || kind === ts.SyntaxKind.PropertyAssignment || kind === ts.SyntaxKind.PropertyDeclaration || kind === ts.SyntaxKind.PropertySignature || kind === ts.SyntaxKind.SetAccessor || kind === ts.SyntaxKind.ShorthandPropertyAssignment || kind === ts.SyntaxKind.TypeAliasDeclaration || kind === ts.SyntaxKind.TypeParameter || kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.JSDocTypedefTag || kind === ts.SyntaxKind.JSDocCallbackTag || kind === ts.SyntaxKind.JSDocPropertyTag || kind === ts.SyntaxKind.NamedTupleMember;
30916
+ }
30914
30917
  return {
30915
30918
  findNodeAtPositionIncludingTrivia,
30916
30919
  parsePackageContentNameAndVersionFromScope,
@@ -30933,7 +30936,8 @@ function makeTypeScriptUtils(ts) {
30933
30936
  parseAccessedExpressionForCompletion,
30934
30937
  getSourceFileOfNode,
30935
30938
  isOuterExpression,
30936
- skipOuterExpressions
30939
+ skipOuterExpressions,
30940
+ isDeclarationKind
30937
30941
  };
30938
30942
  }
30939
30943
 
@@ -32061,7 +32065,16 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
32061
32065
  const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
32062
32066
  if (!moduleSymbol) continue;
32063
32067
  const memberSymbol = typeChecker.tryGetMemberInModuleExports(memberName, moduleSymbol);
32064
- if (memberSymbol && memberSymbol === symbol3) result.push({ memberSymbol, moduleSymbol, sourceFile });
32068
+ if (memberSymbol) {
32069
+ if (memberSymbol === symbol3) {
32070
+ result.push({ memberSymbol, moduleSymbol, sourceFile });
32071
+ } else if (memberSymbol.flags & ts.SymbolFlags.Alias) {
32072
+ const aliased = typeChecker.getAliasedSymbol(memberSymbol);
32073
+ if (aliased === symbol3) {
32074
+ result.push({ memberSymbol, moduleSymbol, sourceFile });
32075
+ }
32076
+ }
32077
+ }
32065
32078
  }
32066
32079
  if (result.length > 0) {
32067
32080
  return result;
@@ -33459,18 +33472,12 @@ var annotate3 = createCodegen({
33459
33472
  for (const variableDeclaration of variableDeclarations) {
33460
33473
  if (!variableDeclaration.initializer) continue;
33461
33474
  const initializerType = typeChecker.getTypeAtLocation(variableDeclaration.initializer);
33475
+ const enclosingNode = ts.findAncestor(variableDeclaration, (_) => tsUtils.isDeclarationKind(_.kind)) || sourceFile;
33462
33476
  const initializerTypeNode = fromNullable(typeCheckerUtils.typeToSimplifiedTypeNode(
33463
33477
  initializerType,
33464
- node,
33465
- ts.NodeBuilderFlags.NoTruncation
33478
+ enclosingNode,
33479
+ ts.NodeBuilderFlags.NoTruncation | ts.NodeBuilderFlags.IgnoreErrors
33466
33480
  )).pipe(
33467
- orElse(
33468
- () => fromNullable(typeCheckerUtils.typeToSimplifiedTypeNode(
33469
- initializerType,
33470
- void 0,
33471
- ts.NodeBuilderFlags.NoTruncation
33472
- ))
33473
- ),
33474
33481
  getOrUndefined
33475
33482
  );
33476
33483
  if (!initializerTypeNode) continue;