@effect/language-service 0.58.0 → 0.58.2

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
@@ -4318,9 +4318,11 @@ var anyUnknownInErrorContext = createDiagnostic({
4318
4318
  }
4319
4319
  if (ts.isParameter(node) || ts.isPropertyDeclaration(node) || ts.isVariableDeclaration(node)) {
4320
4320
  if (node.type) {
4321
+ const typeNode = node.type;
4321
4322
  const type2 = typeChecker.getTypeAtLocation(node.type);
4322
4323
  const expectedEffect = yield* pipe(
4323
4324
  typeParser.strictEffectType(type2, node.type),
4325
+ orElse2(() => typeParser.layerType(type2, typeNode)),
4324
4326
  orElse2(() => void_)
4325
4327
  );
4326
4328
  if (expectedEffect) continue;
@@ -4328,6 +4330,10 @@ var anyUnknownInErrorContext = createDiagnostic({
4328
4330
  }
4329
4331
  ts.forEachChild(node, appendNodeToVisit);
4330
4332
  if (!ts.isExpression(node)) continue;
4333
+ if (node.parent && ts.isJsxSelfClosingElement(node.parent) && node.parent.tagName === node) continue;
4334
+ if (node.parent && ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node) continue;
4335
+ if (node.parent && ts.isJsxClosingElement(node.parent) && node.parent.tagName === node) continue;
4336
+ if (node.parent && ts.isJsxAttribute(node.parent) && node.parent.name === node) continue;
4331
4337
  let type = typeChecker.getTypeAtLocation(node);
4332
4338
  if (ts.isCallExpression(node)) {
4333
4339
  const resolvedSignature = typeChecker.getResolvedSignature(node);
@@ -4338,8 +4344,9 @@ var anyUnknownInErrorContext = createDiagnostic({
4338
4344
  if (!type) continue;
4339
4345
  yield* pipe(
4340
4346
  typeParser.strictEffectType(type, node),
4341
- map5((effect) => {
4342
- const { E, R } = effect;
4347
+ orElse2(() => pipe(typeParser.layerType(type, node), map5(({ E, RIn }) => ({ E, R: RIn })))),
4348
+ map5((effectOrLayer) => {
4349
+ const { E, R } = effectOrLayer;
4343
4350
  const hasAnyUnknownR = isAnyOrUnknown(R);
4344
4351
  const hasAnyUnknownE = isAnyOrUnknown(E);
4345
4352
  if (hasAnyUnknownR || hasAnyUnknownE) {
@@ -4362,7 +4369,7 @@ var anyUnknownInErrorContext = createDiagnostic({
4362
4369
  matchingNodes.splice(i, 1);
4363
4370
  }
4364
4371
  }
4365
- const suggestions = [`This Effect has ${channels.join(" and ")} which is not recommended.`];
4372
+ const suggestions = [`This has ${channels.join(" and ")} which is not recommended.`];
4366
4373
  if (hasAnyUnknownR) {
4367
4374
  suggestions.push(`Only service identifiers should appear in the requirements channel.`);
4368
4375
  }