@effect/language-service 0.55.3 → 0.55.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/index.js CHANGED
@@ -2722,6 +2722,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2722
2722
  const getSourceFilesDeclaringSymbolModule = (packageName) => cachedBy(
2723
2723
  fn("TypeParser.getSourceFilesDeclaringSymbolModule")(function* (symbol3) {
2724
2724
  const result = [];
2725
+ if (!symbol3) return result;
2725
2726
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2726
2727
  for (const sourceFile of symbol3.declarations) {
2727
2728
  if (!ts.isSourceFile(sourceFile)) continue;
@@ -2759,6 +2760,7 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2759
2760
  const getSourceFilesDeclaringSymbolExportedUnderPackageModule = (packageName, memberName) => cachedBy(
2760
2761
  fn("TypeParser.getSourceFilesDeclaringSymbolUnderPackageExportedMember")(function* (symbol3) {
2761
2762
  const result = [];
2763
+ if (!symbol3) return result;
2762
2764
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2763
2765
  for (const declaration of symbol3.declarations) {
2764
2766
  const sourceFile = tsUtils.getSourceFileOfNode(declaration);
@@ -2980,14 +2982,14 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2980
2982
  );
2981
2983
  const importedContextModule = cachedBy(
2982
2984
  fn("TypeParser.importedContextModule")(function* (node) {
2985
+ if (!ts.isIdentifier(node)) {
2986
+ return yield* typeParserIssue("Node is not an identifier", void 0, node);
2987
+ }
2983
2988
  const type = typeChecker.getTypeAtLocation(node);
2984
2989
  const propertySymbol = typeChecker.getPropertyOfType(type, "Tag");
2985
2990
  if (!propertySymbol) {
2986
2991
  return yield* typeParserIssue("Type has no 'Tag' property", type, node);
2987
2992
  }
2988
- if (!ts.isIdentifier(node)) {
2989
- return yield* typeParserIssue("Node is not an identifier", type, node);
2990
- }
2991
2993
  const sourceFile = tsUtils.getSourceFileOfNode(node);
2992
2994
  if (!sourceFile) {
2993
2995
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -3014,14 +3016,14 @@ function make3(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
3014
3016
  );
3015
3017
  const importedDataModule = cachedBy(
3016
3018
  fn("TypeParser.importedDataModule")(function* (node) {
3019
+ if (!ts.isIdentifier(node)) {
3020
+ return yield* typeParserIssue("Node is not an expression", void 0, node);
3021
+ }
3017
3022
  const type = typeChecker.getTypeAtLocation(node);
3018
3023
  const propertySymbol = typeChecker.getPropertyOfType(type, "TaggedError");
3019
3024
  if (!propertySymbol) {
3020
3025
  return yield* typeParserIssue("Type has no 'TaggedError' property", type, node);
3021
3026
  }
3022
- if (!ts.isIdentifier(node)) {
3023
- return yield* typeParserIssue("Node is not an expression", type, node);
3024
- }
3025
3027
  const sourceFile = tsUtils.getSourceFileOfNode(node);
3026
3028
  if (!sourceFile) {
3027
3029
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -7216,9 +7218,10 @@ var leakingRequirements = createDiagnostic({
7216
7218
  (type) => {
7217
7219
  let symbol3 = type.symbol;
7218
7220
  if (symbol3 && symbol3.flags & ts.SymbolFlags.Alias) {
7219
- symbol3 = typeChecker.getAliasedSymbol(symbol3);
7221
+ symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
7220
7222
  }
7221
- return !(symbol3.declarations || []).some((declaration) => {
7223
+ if (!symbol3) return false;
7224
+ return !(symbol3?.declarations || []).some((declaration) => {
7222
7225
  const declarationSource = tsUtils.getSourceFileOfNode(declaration);
7223
7226
  if (!declarationSource) return false;
7224
7227
  return declarationSource.text.substring(declaration.pos, declaration.end).toLowerCase().indexOf(
@@ -8481,6 +8484,7 @@ var strictBooleanExpressions = createDiagnostic({
8481
8484
  for (const nodeToCheck of nodes2) {
8482
8485
  if (!nodeToCheck) continue;
8483
8486
  if (!conditionChecks.has(nodeToCheck.parent)) continue;
8487
+ if (!ts.isExpression(nodeToCheck)) continue;
8484
8488
  const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
8485
8489
  const constrainedType = typeChecker.getBaseConstraintOfType(nodeType);
8486
8490
  let typesToCheck = [constrainedType || nodeType];
@@ -14393,7 +14397,7 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
14393
14397
  }
14394
14398
  }
14395
14399
  }
14396
- } else {
14400
+ } else if (ts.isExpression(node2)) {
14397
14401
  layerType = typeChecker.getTypeAtLocation(node2);
14398
14402
  }
14399
14403
  if (layerType) {
@@ -14505,7 +14509,7 @@ var extractLayerGraph = fn("extractLayerGraph")(function* (node, opts) {
14505
14509
  let symbol3 = typeChecker.getSymbolAtLocation(node2);
14506
14510
  if (symbol3) {
14507
14511
  if (symbol3.flags & ts.SymbolFlags.Alias) {
14508
- symbol3 = typeChecker.getAliasedSymbol(symbol3);
14512
+ symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
14509
14513
  }
14510
14514
  if (symbol3.declarations && symbol3.declarations.length === 1) {
14511
14515
  const declarationNode = getAdjustedNode2(symbol3.declarations[0]);