@effect/language-service 0.55.3 → 0.55.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/language-service",
3
- "version": "0.55.3",
3
+ "version": "0.55.5",
4
4
  "description": "A Language-Service Plugin to Refactor and Diagnostic effect-ts projects",
5
5
  "main": "index.cjs",
6
6
  "bin": {
package/transform.js CHANGED
@@ -2520,6 +2520,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2520
2520
  const getSourceFilesDeclaringSymbolModule = (packageName) => cachedBy(
2521
2521
  fn("TypeParser.getSourceFilesDeclaringSymbolModule")(function* (symbol3) {
2522
2522
  const result = [];
2523
+ if (!symbol3) return result;
2523
2524
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2524
2525
  for (const sourceFile of symbol3.declarations) {
2525
2526
  if (!ts.isSourceFile(sourceFile)) continue;
@@ -2557,6 +2558,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2557
2558
  const getSourceFilesDeclaringSymbolExportedUnderPackageModule = (packageName, memberName) => cachedBy(
2558
2559
  fn("TypeParser.getSourceFilesDeclaringSymbolUnderPackageExportedMember")(function* (symbol3) {
2559
2560
  const result = [];
2561
+ if (!symbol3) return result;
2560
2562
  if (!symbol3.declarations) return yield* typeParserIssue("Symbol has no declarations", void 0, void 0);
2561
2563
  for (const declaration of symbol3.declarations) {
2562
2564
  const sourceFile = tsUtils.getSourceFileOfNode(declaration);
@@ -2778,14 +2780,14 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2778
2780
  );
2779
2781
  const importedContextModule = cachedBy(
2780
2782
  fn("TypeParser.importedContextModule")(function* (node) {
2783
+ if (!ts.isIdentifier(node)) {
2784
+ return yield* typeParserIssue("Node is not an identifier", void 0, node);
2785
+ }
2781
2786
  const type = typeChecker.getTypeAtLocation(node);
2782
2787
  const propertySymbol = typeChecker.getPropertyOfType(type, "Tag");
2783
2788
  if (!propertySymbol) {
2784
2789
  return yield* typeParserIssue("Type has no 'Tag' property", type, node);
2785
2790
  }
2786
- if (!ts.isIdentifier(node)) {
2787
- return yield* typeParserIssue("Node is not an identifier", type, node);
2788
- }
2789
2791
  const sourceFile = tsUtils.getSourceFileOfNode(node);
2790
2792
  if (!sourceFile) {
2791
2793
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -2812,14 +2814,14 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
2812
2814
  );
2813
2815
  const importedDataModule = cachedBy(
2814
2816
  fn("TypeParser.importedDataModule")(function* (node) {
2817
+ if (!ts.isIdentifier(node)) {
2818
+ return yield* typeParserIssue("Node is not an expression", void 0, node);
2819
+ }
2815
2820
  const type = typeChecker.getTypeAtLocation(node);
2816
2821
  const propertySymbol = typeChecker.getPropertyOfType(type, "TaggedError");
2817
2822
  if (!propertySymbol) {
2818
2823
  return yield* typeParserIssue("Type has no 'TaggedError' property", type, node);
2819
2824
  }
2820
- if (!ts.isIdentifier(node)) {
2821
- return yield* typeParserIssue("Node is not an expression", type, node);
2822
- }
2823
2825
  const sourceFile = tsUtils.getSourceFileOfNode(node);
2824
2826
  if (!sourceFile) {
2825
2827
  return yield* typeParserIssue("Node is not in a source file", void 0, node);
@@ -4461,9 +4463,10 @@ var leakingRequirements = createDiagnostic({
4461
4463
  (type) => {
4462
4464
  let symbol3 = type.symbol;
4463
4465
  if (symbol3 && symbol3.flags & ts.SymbolFlags.Alias) {
4464
- symbol3 = typeChecker.getAliasedSymbol(symbol3);
4466
+ symbol3 = typeChecker.getAliasedSymbol(symbol3) || symbol3;
4465
4467
  }
4466
- return !(symbol3.declarations || []).some((declaration) => {
4468
+ if (!symbol3) return false;
4469
+ return !(symbol3?.declarations || []).some((declaration) => {
4467
4470
  const declarationSource = tsUtils.getSourceFileOfNode(declaration);
4468
4471
  if (!declarationSource) return false;
4469
4472
  return declarationSource.text.substring(declaration.pos, declaration.end).toLowerCase().indexOf(
@@ -6020,6 +6023,7 @@ var strictBooleanExpressions = createDiagnostic({
6020
6023
  for (const nodeToCheck of nodes) {
6021
6024
  if (!nodeToCheck) continue;
6022
6025
  if (!conditionChecks.has(nodeToCheck.parent)) continue;
6026
+ if (!ts.isExpression(nodeToCheck)) continue;
6023
6027
  const nodeType = typeChecker.getTypeAtLocation(nodeToCheck);
6024
6028
  const constrainedType = typeChecker.getBaseConstraintOfType(nodeType);
6025
6029
  let typesToCheck = [constrainedType || nodeType];