@effect/language-service 0.73.1 → 0.75.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.
@@ -3409,6 +3409,28 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
3409
3409
  `TypeParser.isNodeReferenceToEffectParseResultModuleApi(${memberName})`,
3410
3410
  (node) => node
3411
3411
  );
3412
+ const isEffectSchemaParserSourceFile = cachedBy(
3413
+ fn("TypeParser.isEffectSchemaParserSourceFile")(function* (sourceFile) {
3414
+ const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
3415
+ if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
3416
+ const parseIssueSymbol = typeChecker.tryGetMemberInModuleExports("Parser", moduleSymbol);
3417
+ if (!parseIssueSymbol) return yield* typeParserIssue("ParseIssue type not found", void 0, sourceFile);
3418
+ const decodeSyncSymbol = typeChecker.tryGetMemberInModuleExports("decodeEffect", moduleSymbol);
3419
+ if (!decodeSyncSymbol) return yield* typeParserIssue("decodeSync not found", void 0, sourceFile);
3420
+ const encodeSyncSymbol = typeChecker.tryGetMemberInModuleExports("encodeEffect", moduleSymbol);
3421
+ if (!encodeSyncSymbol) return yield* typeParserIssue("encodeSync not found", void 0, sourceFile);
3422
+ return sourceFile;
3423
+ }),
3424
+ "TypeParser.isEffectSchemaParserSourceFile",
3425
+ (sourceFile) => sourceFile
3426
+ );
3427
+ const isNodeReferenceToEffectSchemaParserModuleApi = (memberName) => cachedBy(
3428
+ fn("TypeParser.isNodeReferenceToEffectSchemaParserModuleApi")(function* (node) {
3429
+ return yield* isNodeReferenceToExportOfPackageModule(node, "effect", isEffectSchemaParserSourceFile, memberName);
3430
+ }),
3431
+ `TypeParser.isNodeReferenceToEffectSchemaParserModuleApi(${memberName})`,
3432
+ (node) => node
3433
+ );
3412
3434
  const contextTagVarianceStruct = (type, atLocation) => map4(
3413
3435
  all(
3414
3436
  varianceStructInvariantType(type, atLocation, "_Identifier"),
@@ -3416,6 +3438,31 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
3416
3438
  ),
3417
3439
  ([Identifier, Service]) => ({ Identifier, Service })
3418
3440
  );
3441
+ const serviceVarianceStruct = (type, atLocation) => map4(
3442
+ all(
3443
+ varianceStructInvariantType(type, atLocation, "_Identifier"),
3444
+ varianceStructInvariantType(type, atLocation, "_Service")
3445
+ ),
3446
+ ([Identifier, Service]) => ({ Identifier, Service })
3447
+ );
3448
+ const serviceType = cachedBy(
3449
+ fn("TypeParser.serviceType")(function* (type, atLocation) {
3450
+ yield* pipeableType(type, atLocation);
3451
+ const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
3452
+ (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
3453
+ );
3454
+ if (propertiesSymbols.length === 0) {
3455
+ return yield* typeParserIssue("Type has no tag variance struct", type, atLocation);
3456
+ }
3457
+ propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
3458
+ return yield* firstSuccessOf(propertiesSymbols.map((propertySymbol) => {
3459
+ const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
3460
+ return serviceVarianceStruct(propertyType, atLocation);
3461
+ }));
3462
+ }),
3463
+ "TypeParser.serviceType",
3464
+ (type) => type
3465
+ );
3419
3466
  const contextTag = cachedBy(
3420
3467
  fn("TypeParser.contextTag")(function* (type, atLocation) {
3421
3468
  yield* pipeableType(type, atLocation);
@@ -3497,14 +3544,22 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
3497
3544
  );
3498
3545
  const scopeType = cachedBy(
3499
3546
  fn("TypeParser.scopeType")(function* (type, atLocation) {
3500
- yield* pipeableType(type, atLocation);
3501
- const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
3502
- (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
3503
- );
3504
- if (propertiesSymbols.some((s) => ts.symbolName(s).indexOf("ScopeTypeId") !== -1)) {
3505
- return type;
3547
+ if (supportedEffect() === "v4") {
3548
+ const typeIdSymbol = typeChecker.getPropertyOfType(type, "~effect/Scope");
3549
+ if (typeIdSymbol) {
3550
+ return type;
3551
+ }
3552
+ return yield* typeParserIssue("Type is not an effect", type, atLocation);
3553
+ } else {
3554
+ yield* pipeableType(type, atLocation);
3555
+ const propertiesSymbols = typeChecker.getPropertiesOfType(type).filter(
3556
+ (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
3557
+ );
3558
+ if (propertiesSymbols.some((s) => ts.symbolName(s).indexOf("ScopeTypeId") !== -1)) {
3559
+ return type;
3560
+ }
3561
+ return yield* typeParserIssue("Type has no scope type id", type, atLocation);
3506
3562
  }
3507
- return yield* typeParserIssue("Type has no scope type id", type, atLocation);
3508
3563
  }),
3509
3564
  "TypeParser.scopeType",
3510
3565
  (type) => type
@@ -3986,6 +4041,55 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
3986
4041
  "TypeParser.extendsEffectService",
3987
4042
  (atLocation) => atLocation
3988
4043
  );
4044
+ const extendsServiceMapService = cachedBy(
4045
+ fn("TypeParser.extendsServiceMapService")(function* (atLocation) {
4046
+ if (!atLocation.name) {
4047
+ return yield* typeParserIssue("Class has no name", void 0, atLocation);
4048
+ }
4049
+ const heritageClauses = atLocation.heritageClauses;
4050
+ if (!heritageClauses) {
4051
+ return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
4052
+ }
4053
+ for (const heritageClause of heritageClauses) {
4054
+ for (const typeX of heritageClause.types) {
4055
+ if (ts.isExpressionWithTypeArguments(typeX)) {
4056
+ const wholeCall = typeX.expression;
4057
+ if (ts.isCallExpression(wholeCall)) {
4058
+ const serviceMapServiceCall = wholeCall.expression;
4059
+ if (ts.isCallExpression(serviceMapServiceCall) && serviceMapServiceCall.typeArguments && serviceMapServiceCall.typeArguments.length > 0) {
4060
+ const serviceMapServiceIdentifier = serviceMapServiceCall.expression;
4061
+ const selfTypeNode = serviceMapServiceCall.typeArguments[0];
4062
+ const isServiceMapService = yield* pipe(
4063
+ isNodeReferenceToServiceMapModuleApi("Service")(serviceMapServiceIdentifier),
4064
+ orUndefined
4065
+ );
4066
+ if (isServiceMapService) {
4067
+ const classSym = typeChecker.getSymbolAtLocation(atLocation.name);
4068
+ if (!classSym) return yield* typeParserIssue("Class has no symbol", void 0, atLocation);
4069
+ const type = typeChecker.getTypeOfSymbol(classSym);
4070
+ const parsedServiceType = yield* pipe(
4071
+ serviceType(type, atLocation),
4072
+ orUndefined
4073
+ );
4074
+ if (parsedServiceType) {
4075
+ return {
4076
+ ...parsedServiceType,
4077
+ className: atLocation.name,
4078
+ selfTypeNode,
4079
+ keyStringLiteral: wholeCall.arguments.length > 0 && ts.isStringLiteral(wholeCall.arguments[0]) ? wholeCall.arguments[0] : void 0
4080
+ };
4081
+ }
4082
+ }
4083
+ }
4084
+ }
4085
+ }
4086
+ }
4087
+ }
4088
+ return yield* typeParserIssue("Class does not extend ServiceMap.Service", void 0, atLocation);
4089
+ }),
4090
+ "TypeParser.extendsServiceMapService",
4091
+ (atLocation) => atLocation
4092
+ );
3989
4093
  const isEffectSqlModelTypeSourceFile = cachedBy(
3990
4094
  fn("TypeParser.isEffectSqlModelTypeSourceFile")(function* (sourceFile) {
3991
4095
  const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
@@ -4078,6 +4182,24 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4078
4182
  `TypeParser.isNodeReferenceToEffectLayerModuleApi(${memberName})`,
4079
4183
  (node) => node
4080
4184
  );
4185
+ const isServiceMapTypeSourceFile = cachedBy(
4186
+ fn("TypeParser.isServiceMapTypeSourceFile")(function* (sourceFile) {
4187
+ const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
4188
+ if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
4189
+ const serviceMapSymbol = typeChecker.tryGetMemberInModuleExports("ServiceMap", moduleSymbol);
4190
+ if (!serviceMapSymbol) return yield* typeParserIssue("ServiceMap not found", void 0, sourceFile);
4191
+ return sourceFile;
4192
+ }),
4193
+ "TypeParser.isServiceMapTypeSourceFile",
4194
+ (sourceFile) => sourceFile
4195
+ );
4196
+ const isNodeReferenceToServiceMapModuleApi = (memberName) => cachedBy(
4197
+ fn("TypeParser.isNodeReferenceToServiceMapModuleApi")(function* (node) {
4198
+ return yield* isNodeReferenceToExportOfPackageModule(node, "effect", isServiceMapTypeSourceFile, memberName);
4199
+ }),
4200
+ `TypeParser.isNodeReferenceToServiceMapModuleApi(${memberName})`,
4201
+ (node) => node
4202
+ );
4081
4203
  const lazyExpression = cachedBy(
4082
4204
  function(node) {
4083
4205
  if (!ts.isArrowFunction(node) && !ts.isFunctionExpression(node)) {
@@ -4408,6 +4530,9 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4408
4530
  isNodeReferenceToEffectContextModuleApi,
4409
4531
  isNodeReferenceToEffectSqlModelModuleApi,
4410
4532
  isNodeReferenceToEffectLayerModuleApi,
4533
+ isNodeReferenceToEffectSchemaParserModuleApi,
4534
+ isServiceMapTypeSourceFile,
4535
+ isNodeReferenceToServiceMapModuleApi,
4411
4536
  effectType,
4412
4537
  strictEffectType,
4413
4538
  layerType,
@@ -4423,6 +4548,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4423
4548
  unnecessaryEffectGen: unnecessaryEffectGen2,
4424
4549
  effectSchemaType,
4425
4550
  contextTag,
4551
+ serviceType,
4426
4552
  pipeableType,
4427
4553
  pipeCall,
4428
4554
  singleArgCall,
@@ -4430,6 +4556,7 @@ function make2(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
4430
4556
  promiseLike,
4431
4557
  extendsEffectTag,
4432
4558
  extendsEffectService,
4559
+ extendsServiceMapService,
4433
4560
  extendsContextTag,
4434
4561
  extendsSchemaClass,
4435
4562
  extendsSchemaTaggedClass,
@@ -4907,6 +5034,7 @@ var deterministicKeys = createDiagnostic({
4907
5034
  typeParser.extendsEffectService(node),
4908
5035
  orElse2(() => typeParser.extendsContextTag(node)),
4909
5036
  orElse2(() => typeParser.extendsEffectTag(node)),
5037
+ orElse2(() => typeParser.extendsServiceMapService(node)),
4910
5038
  map4(({ className, keyStringLiteral }) => ({ keyStringLiteral, className, target: "service" }))
4911
5039
  ),
4912
5040
  orElse2(
@@ -6302,6 +6430,9 @@ More info and examples at https://effect.website/docs/requirements-management/la
6302
6430
  if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "GenericTag") {
6303
6431
  const nodeType = typeCheckerUtils.getTypeAtLocation(node);
6304
6432
  if (nodeType) typesToCheck.push([nodeType, node]);
6433
+ } else if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "Service") {
6434
+ const nodeType = typeCheckerUtils.getTypeAtLocation(node);
6435
+ if (nodeType) typesToCheck.push([nodeType, node]);
6305
6436
  } else if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
6306
6437
  const classSym = typeChecker.getSymbolAtLocation(node.name);
6307
6438
  if (classSym) {
@@ -6315,6 +6446,7 @@ More info and examples at https://effect.website/docs/requirements-management/la
6315
6446
  for (const [type, reportAt] of typesToCheck) {
6316
6447
  yield* pipe(
6317
6448
  typeParser.contextTag(type, node),
6449
+ orElse2(() => typeParser.serviceType(type, node)),
6318
6450
  flatMap2(
6319
6451
  ({ Service }) => pipe(
6320
6452
  parseLeakedRequirements(Service, node),
@@ -7089,6 +7221,7 @@ var nonObjectEffectServiceType = createDiagnostic({
7089
7221
  const typeChecker = yield* service(TypeCheckerApi);
7090
7222
  const typeCheckerUtils = yield* service(TypeCheckerUtils);
7091
7223
  const typeParser = yield* service(TypeParser);
7224
+ if (typeParser.supportedEffect() === "v4") return;
7092
7225
  function isPrimitiveType(type) {
7093
7226
  return typeCheckerUtils.unrollUnionMembers(type).some(
7094
7227
  (type2) => !!(type2.flags & ts.TypeFlags.String || type2.flags & ts.TypeFlags.Number || type2.flags & ts.TypeFlags.Boolean || type2.flags & ts.TypeFlags.StringLiteral || type2.flags & ts.TypeFlags.NumberLiteral || type2.flags & ts.TypeFlags.BooleanLiteral || type2.flags & ts.TypeFlags.Undefined || type2.flags & ts.TypeFlags.Null)
@@ -7373,6 +7506,7 @@ var parse2 = fn("writeTagClassAccessors.parse")(function* (node) {
7373
7506
  const typeChecker = yield* service(TypeCheckerApi);
7374
7507
  const typeParser = yield* service(TypeParser);
7375
7508
  const typeCheckerUtils = yield* service(TypeCheckerUtils);
7509
+ if (typeParser.supportedEffect() === "v4") return yield* fail("not applicable to Effect v4");
7376
7510
  if (!ts.isClassDeclaration(node)) return yield* fail("not a class declaration");
7377
7511
  const { Service, accessors: accessors2, className, kind } = yield* pipe(
7378
7512
  map4(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
@@ -7615,16 +7749,16 @@ var pushHoistedVariableStatement = fn("StructuralSchemaGen.pushHoistedVariableSt
7615
7749
  );
7616
7750
  }
7617
7751
  );
7618
- var createProcessingContext = (maxDepth = 200) => ({
7752
+ var createProcessingContext = (supportedEffect, maxDepth = 200) => ({
7619
7753
  depth: 0,
7620
7754
  maxDepth,
7621
- hoistName: void 0
7755
+ hoistName: void 0,
7756
+ supportedEffect
7622
7757
  });
7623
7758
  var processType = fn(
7624
7759
  "StructuralSchemaGen.processType"
7625
7760
  )(
7626
- function* (type, context) {
7627
- const processingContext = context || createProcessingContext();
7761
+ function* (type, processingContext) {
7628
7762
  const { hoistedSchemas, nameToType, ts, typeChecker, usedGlobalIdentifiers } = yield* service(
7629
7763
  StructuralSchemaGenContext
7630
7764
  );
@@ -7759,7 +7893,7 @@ var processUnionType = fn(
7759
7893
  const allLiterals = types.every(
7760
7894
  (t) => t.flags & ts.TypeFlags.StringLiteral || t.flags & ts.TypeFlags.NumberLiteral || t.flags & ts.TypeFlags.BooleanLiteral
7761
7895
  );
7762
- if (allLiterals) {
7896
+ if (allLiterals && context.supportedEffect !== "v4") {
7763
7897
  const literals = yield* all(
7764
7898
  ...types.map((t) => processType(t, context))
7765
7899
  );
@@ -7769,7 +7903,13 @@ var processUnionType = fn(
7769
7903
  }
7770
7904
  return expr;
7771
7905
  }).filter((arg) => arg !== void 0);
7772
- return [createApiCall("Literal", literalValues), false];
7906
+ return [
7907
+ createApiCall(
7908
+ "Literal",
7909
+ literalValues
7910
+ ),
7911
+ false
7912
+ ];
7773
7913
  }
7774
7914
  const members = yield* all(
7775
7915
  ...types.map((t) => processType(t, context))
@@ -7777,7 +7917,13 @@ var processUnionType = fn(
7777
7917
  if (members.length === 1) {
7778
7918
  return [members[0], false];
7779
7919
  }
7780
- return [createApiCall("Union", members), false];
7920
+ return [
7921
+ createApiCall(
7922
+ "Union",
7923
+ context.supportedEffect === "v4" ? [ts.factory.createArrayLiteralExpression(members)] : members
7924
+ ),
7925
+ false
7926
+ ];
7781
7927
  }
7782
7928
  );
7783
7929
  var processIntersectionType = fn(
@@ -7823,12 +7969,18 @@ var processTupleType = fn(
7823
7969
  "StructuralSchemaGen.processTupleType"
7824
7970
  )(
7825
7971
  function* (type, context) {
7826
- const { createApiCall, typeChecker } = yield* service(StructuralSchemaGenContext);
7972
+ const { createApiCall, ts, typeChecker } = yield* service(StructuralSchemaGenContext);
7827
7973
  const typeArgs = typeChecker.getTypeArguments(type);
7828
7974
  const elementSchemas = yield* all(
7829
7975
  ...typeArgs.map((t) => processType(t, context))
7830
7976
  );
7831
- return [createApiCall("Tuple", elementSchemas), false];
7977
+ return [
7978
+ createApiCall(
7979
+ "Tuple",
7980
+ context.supportedEffect === "v4" ? [ts.factory.createArrayLiteralExpression(elementSchemas)] : elementSchemas
7981
+ ),
7982
+ false
7983
+ ];
7832
7984
  }
7833
7985
  );
7834
7986
  var processObjectType = fn(
@@ -7845,7 +7997,6 @@ var processObjectType = fn(
7845
7997
  } = yield* service(
7846
7998
  StructuralSchemaGenContext
7847
7999
  );
7848
- let hasRecords = false;
7849
8000
  const properties = typeChecker.getPropertiesOfType(type);
7850
8001
  const propertyAssignments = [];
7851
8002
  for (const property of properties) {
@@ -7885,20 +8036,28 @@ var processObjectType = fn(
7885
8036
  const args2 = [
7886
8037
  ts.factory.createObjectLiteralExpression(propertyAssignments, propertyAssignments.length > 0)
7887
8038
  ];
8039
+ const records = [];
7888
8040
  for (const indexInfo of indexInfos) {
7889
- hasRecords = true;
7890
8041
  const keyType = indexInfo.keyType;
7891
8042
  const valueType = indexInfo.type;
7892
8043
  const keySchema = yield* processType(keyType, context);
7893
8044
  const valueSchema = yield* processType(valueType, context);
7894
- args2.push(
7895
- ts.factory.createObjectLiteralExpression([
7896
- ts.factory.createPropertyAssignment("key", keySchema),
7897
- ts.factory.createPropertyAssignment("value", valueSchema)
7898
- ])
7899
- );
8045
+ records.push({ key: keySchema, value: valueSchema });
8046
+ }
8047
+ if (context.supportedEffect === "v4") {
8048
+ if (records.length > 0) {
8049
+ return [
8050
+ createApiCall("StructWithRest", [
8051
+ createApiCall("Struct", args2),
8052
+ ts.factory.createArrayLiteralExpression(
8053
+ records.map(({ key, value }) => createApiCall("Record", [key, value]))
8054
+ )
8055
+ ]),
8056
+ propertyAssignments.length === 0
8057
+ ];
8058
+ }
7900
8059
  }
7901
- if (!hasRecords && context.hoistName) {
8060
+ if (records.length === 0 && context.hoistName) {
7902
8061
  const ctx = yield* service(StructuralSchemaGenContext);
7903
8062
  yield* pushHoistedStatement(
7904
8063
  ctx,
@@ -7933,6 +8092,14 @@ var processObjectType = fn(
7933
8092
  );
7934
8093
  return [ctx.hoistedSchemas.get(type)(), true];
7935
8094
  }
8095
+ for (const { key, value } of records) {
8096
+ args2.push(
8097
+ ts.factory.createObjectLiteralExpression([
8098
+ ts.factory.createPropertyAssignment("key", key),
8099
+ ts.factory.createPropertyAssignment("value", value)
8100
+ ])
8101
+ );
8102
+ }
7936
8103
  return [createApiCall("Struct", args2), propertyAssignments.length === 0];
7937
8104
  }
7938
8105
  );
@@ -8018,7 +8185,7 @@ var process = fn("StructuralSchemaGen.process")(
8018
8185
  all(
8019
8186
  ...fromIterable(ctx.nameToType.entries()).map(
8020
8187
  ([name, type]) => pipe(
8021
- processType(type),
8188
+ processType(type, createProcessingContext(typeParser.supportedEffect())),
8022
8189
  orElse2(
8023
8190
  (error) => succeed(ts.addSyntheticLeadingComment(
8024
8191
  ts.factory.createIdentifier(""),
@@ -8600,6 +8767,7 @@ var runEffectInsideEffect = createDiagnostic({
8600
8767
  const ts = yield* service(TypeScriptApi);
8601
8768
  const typeParser = yield* service(TypeParser);
8602
8769
  const tsUtils = yield* service(TypeScriptUtils);
8770
+ if (typeParser.supportedEffect() === "v4") return;
8603
8771
  const parseEffectMethod = (node, methodName) => pipe(
8604
8772
  typeParser.isNodeReferenceToEffectModuleApi(methodName)(node),
8605
8773
  map4(() => ({ node, methodName }))
@@ -8794,12 +8962,18 @@ var schemaStructWithTag = createDiagnostic({
8794
8962
  });
8795
8963
 
8796
8964
  // src/diagnostics/schemaSyncInEffect.ts
8797
- var syncToEffectMethod = {
8965
+ var syncToEffectMethodV3 = {
8798
8966
  decodeSync: "decode",
8799
8967
  decodeUnknownSync: "decodeUnknown",
8800
8968
  encodeSync: "encode",
8801
8969
  encodeUnknownSync: "encodeUnknown"
8802
8970
  };
8971
+ var syncToEffectMethodV4 = {
8972
+ decodeSync: "decodeEffect",
8973
+ decodeUnknownSync: "decodeUnknownEffect",
8974
+ encodeSync: "encodeEffect",
8975
+ encodeUnknownSync: "encodeUnknownEffect"
8976
+ };
8803
8977
  var schemaSyncInEffect = createDiagnostic({
8804
8978
  name: "schemaSyncInEffect",
8805
8979
  code: 43,
@@ -8808,8 +8982,10 @@ var schemaSyncInEffect = createDiagnostic({
8808
8982
  apply: fn("schemaSyncInEffect.apply")(function* (sourceFile, report) {
8809
8983
  const ts = yield* service(TypeScriptApi);
8810
8984
  const typeParser = yield* service(TypeParser);
8985
+ const syncToEffectMethod = typeParser.supportedEffect() === "v3" ? syncToEffectMethodV3 : syncToEffectMethodV4;
8811
8986
  const parseSchemaSyncMethod = (node, methodName) => pipe(
8812
8987
  typeParser.isNodeReferenceToEffectParseResultModuleApi(methodName)(node),
8988
+ orElse2(() => typeParser.isNodeReferenceToEffectSchemaParserModuleApi(methodName)(node)),
8813
8989
  map4(() => ({ node, methodName }))
8814
8990
  );
8815
8991
  const nodeToVisit = [];
@@ -8839,7 +9015,7 @@ var schemaSyncInEffect = createDiagnostic({
8839
9015
  const effectMethodName = syncToEffectMethod[isSchemaSyncCall.value.methodName];
8840
9016
  report({
8841
9017
  location: node.expression,
8842
- messageText: `Using ${nodeText} inside an Effect generator is not recommended. Use Schema.${effectMethodName} instead to get properly typed ParseError in the error channel.`,
9018
+ messageText: `Using ${nodeText} inside an Effect generator is not recommended. Use Schema.${effectMethodName} instead to get properly typed error channel.`,
8843
9019
  fixes: []
8844
9020
  });
8845
9021
  }
@@ -8855,6 +9031,7 @@ var schemaUnionOfLiterals = createDiagnostic({
8855
9031
  apply: fn("schemaUnionOfLiterals.apply")(function* (sourceFile, report) {
8856
9032
  const ts = yield* service(TypeScriptApi);
8857
9033
  const typeParser = yield* service(TypeParser);
9034
+ if (typeParser.supportedEffect() === "v4") return;
8858
9035
  const nodeToVisit = [];
8859
9036
  const appendNodeToVisit = (node) => {
8860
9037
  nodeToVisit.push(node);