@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.
@@ -2524,6 +2524,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2524
2524
  const getSourceFilesDeclaringSymbolModule = (packageName) => cachedBy(
2525
2525
  fn("TypeParser.getSourceFilesDeclaringSymbolModule")(function* (symbol3) {
2526
2526
  const result = [];
2527
+ if (!symbol3) return result;
2527
2528
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2528
2529
  for (const sourceFile of symbol3.declarations) {
2529
2530
  if (!ts.isSourceFile(sourceFile)) continue;
@@ -2561,6 +2562,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2561
2562
  const getSourceFilesDeclaringSymbolExportedUnderPackageModule = (packageName, memberName) => cachedBy(
2562
2563
  fn("TypeParser.getSourceFilesDeclaringSymbolUnderPackageExportedMember")(function* (symbol3) {
2563
2564
  const result = [];
2565
+ if (!symbol3) return result;
2564
2566
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2565
2567
  for (const declaration of symbol3.declarations) {
2566
2568
  const sourceFile = tsUtils.getSourceFileOfNode(declaration);
@@ -2782,14 +2784,14 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2782
2784
  );
2783
2785
  const importedContextModule = cachedBy(
2784
2786
  fn("TypeParser.importedContextModule")(function* (node) {
2787
+ if (!ts.isIdentifier(node)) {
2788
+ return yield* typeParserIssue("Node is not an identifier", void 0, node);
2789
+ }
2785
2790
  const type = typeChecker.getTypeAtLocation(node);
2786
2791
  const propertySymbol = typeChecker.getPropertyOfType(type, "Tag");
2787
2792
  if (!propertySymbol) {
2788
2793
  return yield* typeParserIssue("Type has no 'Tag' property", type, node);
2789
2794
  }
2790
- if (!ts.isIdentifier(node)) {
2791
- return yield* typeParserIssue("Node is not an identifier", type, node);
2792
- }
2793
2795
  const sourceFile = tsUtils.getSourceFileOfNode(node);
2794
2796
  if (!sourceFile) {
2795
2797
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -2816,14 +2818,14 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2816
2818
  );
2817
2819
  const importedDataModule = cachedBy(
2818
2820
  fn("TypeParser.importedDataModule")(function* (node) {
2821
+ if (!ts.isIdentifier(node)) {
2822
+ return yield* typeParserIssue("Node is not an expression", void 0, node);
2823
+ }
2819
2824
  const type = typeChecker.getTypeAtLocation(node);
2820
2825
  const propertySymbol = typeChecker.getPropertyOfType(type, "TaggedError");
2821
2826
  if (!propertySymbol) {
2822
2827
  return yield* typeParserIssue("Type has no 'TaggedError' property", type, node);
2823
2828
  }
2824
- if (!ts.isIdentifier(node)) {
2825
- return yield* typeParserIssue("Node is not an expression", type, node);
2826
- }
2827
2829
  const sourceFile = tsUtils.getSourceFileOfNode(node);
2828
2830
  if (!sourceFile) {
2829
2831
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -4465,9 +4467,10 @@ var leakingRequirements = createDiagnostic({
4465
4467
  (type) => {
4466
4468
  let symbol3 = type.symbol;
4467
4469
  if (symbol3 && symbol3.flags & ts.SymbolFlags.Alias) {
4468
- symbol3 = typeChecker.getAliasedSymbol(symbol3);
4470
+ symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
4469
4471
  }
4470
- return !(symbol3.declarations || []).some((declaration) => {
4472
+ if (!symbol3) return false;
4473
+ return !(symbol3?.declarations || []).some((declaration) => {
4471
4474
  const declarationSource = tsUtils.getSourceFileOfNode(declaration);
4472
4475
  if (!declarationSource) return false;
4473
4476
  return declarationSource.text.substring(declaration.pos, declaration.end).toLowerCase().indexOf(
@@ -6024,6 +6027,7 @@ var strictBooleanExpressions = createDiagnostic({
6024
6027
  for (const nodeToCheck of nodes) {
6025
6028
  if (!nodeToCheck) continue;
6026
6029
  if (!conditionChecks.has(nodeToCheck.parent)) continue;
6030
+ if (!ts.isExpression(nodeToCheck)) continue;
6027
6031
  const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
6028
6032
  const constrainedType = typeChecker.getBaseConstraintOfType(nodeType);
6029
6033
  let typesToCheck = [constrainedType || nodeType];