@effect/language-service 0.84.1 → 0.84.3
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/cli.js +159 -106
- package/cli.js.map +1 -1
- package/effect-lsp-patch-utils.js +112 -59
- package/effect-lsp-patch-utils.js.map +1 -1
- package/index.js +112 -59
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/transform.js +112 -59
- package/transform.js.map +1 -1
package/cli.js
CHANGED
|
@@ -25942,7 +25942,7 @@ var runWith2 = (command, config2) => {
|
|
|
25942
25942
|
// package.json
|
|
25943
25943
|
var package_default = {
|
|
25944
25944
|
name: "@effect/language-service",
|
|
25945
|
-
version: "0.84.
|
|
25945
|
+
version: "0.84.3",
|
|
25946
25946
|
publishConfig: {
|
|
25947
25947
|
access: "public",
|
|
25948
25948
|
directory: "dist"
|
|
@@ -28665,10 +28665,42 @@ function makeTypeCheckerUtils(ts, typeChecker, tsUtils) {
|
|
|
28665
28665
|
if (node.parent && ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node) return;
|
|
28666
28666
|
if (node.parent && ts.isJsxClosingElement(node.parent) && node.parent.tagName === node) return;
|
|
28667
28667
|
if (node.parent && ts.isJsxAttribute(node.parent) && node.parent.name === node) return;
|
|
28668
|
+
if (isInsideTypeOnlyHeritageExpression(node)) return;
|
|
28668
28669
|
if (ts.isExpression(node) || ts.isTypeNode(node)) {
|
|
28669
28670
|
return typeChecker.getTypeAtLocation(node);
|
|
28670
28671
|
}
|
|
28671
28672
|
}
|
|
28673
|
+
function isInsideTypeOnlyHeritageExpression(node) {
|
|
28674
|
+
if (ts.isExpressionWithTypeArguments(node)) {
|
|
28675
|
+
return isTypeOnlyHeritageClause(node.parent);
|
|
28676
|
+
}
|
|
28677
|
+
if (!ts.isIdentifier(node) && !ts.isPropertyAccessExpression(node)) {
|
|
28678
|
+
return false;
|
|
28679
|
+
}
|
|
28680
|
+
for (let current = node.parent; current; current = current.parent) {
|
|
28681
|
+
if (ts.isPropertyAccessExpression(current)) {
|
|
28682
|
+
continue;
|
|
28683
|
+
}
|
|
28684
|
+
if (ts.isExpressionWithTypeArguments(current)) {
|
|
28685
|
+
return isTypeOnlyHeritageClause(current.parent);
|
|
28686
|
+
}
|
|
28687
|
+
return false;
|
|
28688
|
+
}
|
|
28689
|
+
return false;
|
|
28690
|
+
}
|
|
28691
|
+
function isTypeOnlyHeritageClause(node) {
|
|
28692
|
+
if (!node || !ts.isHeritageClause(node)) {
|
|
28693
|
+
return false;
|
|
28694
|
+
}
|
|
28695
|
+
const container = node.parent;
|
|
28696
|
+
if (!container) {
|
|
28697
|
+
return false;
|
|
28698
|
+
}
|
|
28699
|
+
if (ts.isInterfaceDeclaration(container)) {
|
|
28700
|
+
return true;
|
|
28701
|
+
}
|
|
28702
|
+
return ts.isClassLike(container) && node.token === ts.SyntaxKind.ImplementsKeyword;
|
|
28703
|
+
}
|
|
28672
28704
|
function resolveToGlobalSymbol(symbol4) {
|
|
28673
28705
|
if (symbol4.flags & ts.SymbolFlags.Alias) {
|
|
28674
28706
|
symbol4 = typeChecker.getAliasedSymbol(symbol4);
|
|
@@ -28992,6 +29024,14 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
28992
29024
|
),
|
|
28993
29025
|
([A, E, R]) => ({ A, E, R })
|
|
28994
29026
|
);
|
|
29027
|
+
const streamVarianceStruct = (type, atLocation) => map12(
|
|
29028
|
+
all3(
|
|
29029
|
+
varianceStructCovariantType(type, atLocation, "_A"),
|
|
29030
|
+
varianceStructCovariantType(type, atLocation, "_E"),
|
|
29031
|
+
varianceStructCovariantType(type, atLocation, "_R")
|
|
29032
|
+
),
|
|
29033
|
+
([A, E, R]) => ({ A, E, R })
|
|
29034
|
+
);
|
|
28995
29035
|
const layerVarianceStruct = (type, atLocation) => map12(
|
|
28996
29036
|
all3(
|
|
28997
29037
|
varianceStructContravariantType(type, atLocation, "_ROut"),
|
|
@@ -29038,6 +29078,21 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
29038
29078
|
"TypeParser.strictEffectType",
|
|
29039
29079
|
(type) => type
|
|
29040
29080
|
);
|
|
29081
|
+
const streamType = cachedBy(
|
|
29082
|
+
fn3("TypeParser.streamType")(function* (type, atLocation) {
|
|
29083
|
+
if (supportedEffect() === "v3") {
|
|
29084
|
+
return yield* effectType(type, atLocation);
|
|
29085
|
+
}
|
|
29086
|
+
const typeIdSymbol = typeChecker.getPropertyOfType(type, "~effect/Stream");
|
|
29087
|
+
if (!typeIdSymbol) {
|
|
29088
|
+
return yield* typeParserIssue("Type is not a stream", type, atLocation);
|
|
29089
|
+
}
|
|
29090
|
+
const typeIdType = typeChecker.getTypeOfSymbolAtLocation(typeIdSymbol, atLocation);
|
|
29091
|
+
return yield* streamVarianceStruct(typeIdType, atLocation);
|
|
29092
|
+
}),
|
|
29093
|
+
"TypeParser.streamType",
|
|
29094
|
+
(type) => type
|
|
29095
|
+
);
|
|
29041
29096
|
const isEffectTypeSourceFile = cachedBy(
|
|
29042
29097
|
fn3("TypeParser.isEffectTypeSourceFile")(function* (sourceFile) {
|
|
29043
29098
|
const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
|
|
@@ -30773,6 +30828,7 @@ function make26(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
|
|
|
30773
30828
|
isServiceMapTypeSourceFile,
|
|
30774
30829
|
isNodeReferenceToServiceMapModuleApi,
|
|
30775
30830
|
effectType,
|
|
30831
|
+
streamType,
|
|
30776
30832
|
strictEffectType,
|
|
30777
30833
|
layerType,
|
|
30778
30834
|
fiberType,
|
|
@@ -33455,7 +33511,7 @@ var catchAllToMapError = createDiagnostic({
|
|
|
33455
33511
|
const { failArg, failCall } = failCallInfo;
|
|
33456
33512
|
report({
|
|
33457
33513
|
location: transformation.callee,
|
|
33458
|
-
messageText:
|
|
33514
|
+
messageText: `\`Effect.mapError\` expresses the same error-type transformation more directly than \`Effect.${catchAllName}\` followed by \`Effect.fail\`.`,
|
|
33459
33515
|
fixes: [{
|
|
33460
33516
|
fixName: "catchAllToMapError_fix",
|
|
33461
33517
|
description: "Replace with Effect.mapError",
|
|
@@ -33519,7 +33575,7 @@ var catchUnfailableEffect = createDiagnostic({
|
|
|
33519
33575
|
if (E.flags & ts.TypeFlags.Never) {
|
|
33520
33576
|
report({
|
|
33521
33577
|
location: transformation.callee,
|
|
33522
|
-
messageText:
|
|
33578
|
+
messageText: "The previous Effect does not fail, so this error-handling branch will never run.",
|
|
33523
33579
|
fixes: []
|
|
33524
33580
|
});
|
|
33525
33581
|
}
|
|
@@ -33582,7 +33638,7 @@ var classSelfMismatch = createDiagnostic({
|
|
|
33582
33638
|
if (actualName !== expectedName) {
|
|
33583
33639
|
report({
|
|
33584
33640
|
location: selfTypeNode,
|
|
33585
|
-
messageText: `Self type parameter should be
|
|
33641
|
+
messageText: `The \`Self\` type parameter for this class should be \`${expectedName}\`.`,
|
|
33586
33642
|
fixes: [{
|
|
33587
33643
|
fixName: "classSelfMismatch_fix",
|
|
33588
33644
|
description: `Replace '${actualName}' with '${expectedName}'`,
|
|
@@ -33772,7 +33828,7 @@ var deterministicKeys = createDiagnostic({
|
|
|
33772
33828
|
if (actualIdentifier !== expectedKey) {
|
|
33773
33829
|
report({
|
|
33774
33830
|
location: keyStringLiteral,
|
|
33775
|
-
messageText: `
|
|
33831
|
+
messageText: `This key does not match the deterministic key for this declaration. The expected key is \`${expectedKey}\`.`,
|
|
33776
33832
|
fixes: [{
|
|
33777
33833
|
fixName: "deterministicKeys_fix",
|
|
33778
33834
|
description: `Replace '${actualIdentifier}' with '${expectedKey}'`,
|
|
@@ -33811,9 +33867,8 @@ var duplicatePackage = createDiagnostic({
|
|
|
33811
33867
|
const versions = Object.keys(resolvedPackages[packageName]);
|
|
33812
33868
|
report({
|
|
33813
33869
|
location: sourceFile.statements[0],
|
|
33814
|
-
messageText: `
|
|
33815
|
-
|
|
33816
|
-
If this is intended set the LSP config "allowedDuplicatedPackages" to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
33870
|
+
messageText: `Multiple versions of package \`${packageName}\` were detected: ${versions.join(", ")}. Package duplication can change runtime identity and type equality across Effect modules.
|
|
33871
|
+
If this is intentional, set the LSP config \`allowedDuplicatedPackages\` to ${JSON.stringify(options.allowedDuplicatedPackages.concat([packageName]))}.
|
|
33817
33872
|
|
|
33818
33873
|
${versions.map((version2) => `- found ${version2} at ${resolvedPackages[packageName][version2]}`).join("\n")}`,
|
|
33819
33874
|
fixes: []
|
|
@@ -33921,7 +33976,7 @@ var effectFnIife = createDiagnostic({
|
|
|
33921
33976
|
const traceExpressionText = traceExpression ? sourceFile.text.slice(traceExpression.pos, traceExpression.end) : void 0;
|
|
33922
33977
|
report({
|
|
33923
33978
|
location: node,
|
|
33924
|
-
messageText:
|
|
33979
|
+
messageText: `\`${effectModuleName}.${kind}\` returns a reusable function that can take arguments, but it is invoked immediately here. \`Effect.gen\` represents the immediate-use form for this pattern${traceExpressionText ? ` with \`Effect.withSpan(${traceExpressionText})\` piped at the end to maintain tracing spans` : ``}.`,
|
|
33925
33980
|
fixes
|
|
33926
33981
|
});
|
|
33927
33982
|
}
|
|
@@ -34006,7 +34061,7 @@ var effectFnImplicitAny = createDiagnostic({
|
|
|
34006
34061
|
const parameterName = getParameterName(ts, parameter.name);
|
|
34007
34062
|
report({
|
|
34008
34063
|
location: parameter.name,
|
|
34009
|
-
messageText: `Parameter
|
|
34064
|
+
messageText: `Parameter \`${parameterName}\` implicitly has type \`any\` in \`Effect.fn\`, \`Effect.fnUntraced\`, or \`Effect.fnUntracedEager\`. No parameter type is available from an explicit annotation or contextual function type.`,
|
|
34010
34065
|
fixes: []
|
|
34011
34066
|
});
|
|
34012
34067
|
}
|
|
@@ -34602,7 +34657,7 @@ var effectFnOpportunity = createDiagnostic({
|
|
|
34602
34657
|
const expectedSignature = generateExpectedSignature();
|
|
34603
34658
|
report({
|
|
34604
34659
|
location: nameIdentifier ?? targetNode,
|
|
34605
|
-
messageText: `
|
|
34660
|
+
messageText: `This expression can be rewritten in the reusable function form \`${expectedSignature}\`.`,
|
|
34606
34661
|
fixes
|
|
34607
34662
|
});
|
|
34608
34663
|
}
|
|
@@ -34814,7 +34869,7 @@ var effectMapVoid = createDiagnostic({
|
|
|
34814
34869
|
if (isNone2(match9)) continue;
|
|
34815
34870
|
report({
|
|
34816
34871
|
location: node.expression,
|
|
34817
|
-
messageText: "
|
|
34872
|
+
messageText: "This expression discards the success value through mapping. `Effect.asVoid` represents that form directly.",
|
|
34818
34873
|
fixes: [{
|
|
34819
34874
|
fixName: "effectMapVoid_fix",
|
|
34820
34875
|
description: "Replace with Effect.asVoid",
|
|
@@ -34869,7 +34924,7 @@ var effectSucceedWithVoid = createDiagnostic({
|
|
|
34869
34924
|
if (!tsUtils.isVoidExpression(argument)) continue;
|
|
34870
34925
|
report({
|
|
34871
34926
|
location: node,
|
|
34872
|
-
messageText: "Effect.void
|
|
34927
|
+
messageText: "`Effect.void` represents the same outcome as `Effect.succeed(undefined)` or `Effect.succeed(void 0)`.",
|
|
34873
34928
|
fixes: [{
|
|
34874
34929
|
fixName: "effectSucceedWithVoid_fix",
|
|
34875
34930
|
description: "Replace with Effect.void",
|
|
@@ -34931,7 +34986,7 @@ var extendsNativeError = createDiagnostic({
|
|
|
34931
34986
|
if (isNativeError) {
|
|
34932
34987
|
report({
|
|
34933
34988
|
location: node.name ?? typeExpression,
|
|
34934
|
-
messageText: "
|
|
34989
|
+
messageText: "This class extends the native `Error` type directly. Untagged native errors lose distinction in the Effect failure channel.",
|
|
34935
34990
|
fixes: []
|
|
34936
34991
|
});
|
|
34937
34992
|
}
|
|
@@ -34976,7 +35031,12 @@ var floatingEffect = createDiagnostic({
|
|
|
34976
35031
|
if (!isFloatingExpression(node)) continue;
|
|
34977
35032
|
const type = typeCheckerUtils.getTypeAtLocation(node.expression);
|
|
34978
35033
|
if (!type) continue;
|
|
34979
|
-
const effect2 = yield* option4(
|
|
35034
|
+
const effect2 = yield* option4(
|
|
35035
|
+
pipe(
|
|
35036
|
+
typeParser.effectType(type, node.expression),
|
|
35037
|
+
orElse5(() => typeParser.streamType(type, node.expression))
|
|
35038
|
+
)
|
|
35039
|
+
);
|
|
34980
35040
|
if (isSome2(effect2)) {
|
|
34981
35041
|
const allowedFloatingEffects = yield* pipe(
|
|
34982
35042
|
typeParser.fiberType(type, node.expression),
|
|
@@ -34985,10 +35045,9 @@ var floatingEffect = createDiagnostic({
|
|
|
34985
35045
|
);
|
|
34986
35046
|
if (isNone2(allowedFloatingEffects)) {
|
|
34987
35047
|
const isStrictEffect = yield* option4(typeParser.strictEffectType(type, node.expression));
|
|
34988
|
-
const name = isSome2(isStrictEffect) ? "Effect" : "Effect-able " + typeChecker.typeToString(type);
|
|
34989
35048
|
report({
|
|
34990
35049
|
location: node,
|
|
34991
|
-
messageText:
|
|
35050
|
+
messageText: isSome2(isStrictEffect) ? "This Effect value is neither yielded nor used in an assignment." : `This Effect-able \`${typeChecker.typeToString(type)}\` value is neither yielded nor assigned to a variable.`,
|
|
34992
35051
|
fixes: []
|
|
34993
35052
|
});
|
|
34994
35053
|
}
|
|
@@ -35083,7 +35142,7 @@ var makeGlobalConsoleApply = (checkInEffect) => fn3(`globalConsole${checkInEffec
|
|
|
35083
35142
|
if (inEffect !== checkInEffect) continue;
|
|
35084
35143
|
report({
|
|
35085
35144
|
location: node,
|
|
35086
|
-
messageText: checkInEffect ? `
|
|
35145
|
+
messageText: checkInEffect ? `This Effect code uses \`console.${method}\`, logging in Effect code is represented through \`${alternative}\`.` : `This code uses \`console.${method}\`, the corresponding Effect logging API is \`${alternative}\`.`,
|
|
35087
35146
|
fixes: []
|
|
35088
35147
|
});
|
|
35089
35148
|
}
|
|
@@ -35132,10 +35191,10 @@ var makeGlobalDateApply = (checkInEffect) => fn3(`globalDate${checkInEffect ? "I
|
|
|
35132
35191
|
let objectNode;
|
|
35133
35192
|
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.idText(node.expression.name) === "now") {
|
|
35134
35193
|
objectNode = node.expression.expression;
|
|
35135
|
-
messageText = checkInEffect ? "
|
|
35194
|
+
messageText = checkInEffect ? "This Effect code uses `Date.now()`, time access in Effect code is represented through `Clock` from Effect." : "This code uses `Date.now()`, time access is represented through `Clock` from Effect.";
|
|
35136
35195
|
} else if (ts.isNewExpression(node)) {
|
|
35137
35196
|
objectNode = node.expression;
|
|
35138
|
-
messageText = checkInEffect ? "
|
|
35197
|
+
messageText = checkInEffect ? "This Effect code constructs `new Date()`, date values in Effect code are represented through `DateTime` from Effect." : "This code constructs `new Date()`, date values are represented through `DateTime` from Effect.";
|
|
35139
35198
|
}
|
|
35140
35199
|
if (!messageText || !objectNode) continue;
|
|
35141
35200
|
const symbol4 = typeChecker.getSymbolAtLocation(objectNode);
|
|
@@ -35218,7 +35277,7 @@ var globalErrorInEffectCatch = createDiagnostic({
|
|
|
35218
35277
|
);
|
|
35219
35278
|
report({
|
|
35220
35279
|
location: node.expression,
|
|
35221
|
-
messageText: `The
|
|
35280
|
+
messageText: `The \`catch\` callback in \`${nodeText}\` returns the global \`Error\` type. Untagged errors merge together in the Effect error channel and lose type-level distinction; a tagged error preserves that distinction and can wrap the original error in a \`cause\` property.`,
|
|
35222
35281
|
fixes: []
|
|
35223
35282
|
});
|
|
35224
35283
|
}
|
|
@@ -35298,7 +35357,7 @@ var makeGlobalFetchApply = (checkInEffect) => fn3(`globalFetch${checkInEffect ?
|
|
|
35298
35357
|
if (!fetchSymbol) return;
|
|
35299
35358
|
const effectVersion = typeParser.supportedEffect();
|
|
35300
35359
|
const packageName = effectVersion === "v3" ? "@effect/platform" : "effect/unstable/http";
|
|
35301
|
-
const messageText = checkInEffect ? `
|
|
35360
|
+
const messageText = checkInEffect ? `This Effect code calls the global \`fetch\` function, HTTP requests in Effect code are represented through \`HttpClient\` from \`${packageName}\`.` : `This code uses the global \`fetch\` function, HTTP requests are represented through \`HttpClient\` from \`${packageName}\`.`;
|
|
35302
35361
|
const nodeToVisit = [];
|
|
35303
35362
|
const appendNodeToVisit = (node) => {
|
|
35304
35363
|
nodeToVisit.push(node);
|
|
@@ -35371,7 +35430,7 @@ var makeGlobalRandomApply = (checkInEffect) => fn3(`globalRandom${checkInEffect
|
|
|
35371
35430
|
if (inEffect !== checkInEffect) continue;
|
|
35372
35431
|
report({
|
|
35373
35432
|
location: node,
|
|
35374
|
-
messageText: checkInEffect ? "
|
|
35433
|
+
messageText: checkInEffect ? "This Effect code uses `Math.random()`, randomness is represented through the Effect `Random` service." : "This code uses `Math.random()`, randomness is represented through the Effect `Random` service.",
|
|
35375
35434
|
fixes: []
|
|
35376
35435
|
});
|
|
35377
35436
|
}
|
|
@@ -35402,12 +35461,12 @@ var globalRandom = createDiagnostic({
|
|
|
35402
35461
|
// src/diagnostics/globalTimersInEffect.ts
|
|
35403
35462
|
var timerAlternatives = {
|
|
35404
35463
|
"setTimeout": {
|
|
35405
|
-
inEffect: "
|
|
35406
|
-
outsideEffect: "
|
|
35464
|
+
inEffect: "This Effect code uses `setTimeout`, the corresponding timer API in this context is `Effect.sleep or Schedule` from Effect.",
|
|
35465
|
+
outsideEffect: "This code uses `setTimeout`, the corresponding Effect timer API is `Effect.sleep or Schedule` from Effect."
|
|
35407
35466
|
},
|
|
35408
35467
|
"setInterval": {
|
|
35409
|
-
inEffect: "
|
|
35410
|
-
outsideEffect: "
|
|
35468
|
+
inEffect: "This Effect code uses `setInterval`, the corresponding timer API in this context is `Schedule or Effect.repeat` from Effect.",
|
|
35469
|
+
outsideEffect: "This code uses `setInterval`, the corresponding Effect timer API is `Schedule or Effect.repeat` from Effect."
|
|
35411
35470
|
}
|
|
35412
35471
|
};
|
|
35413
35472
|
var makeGlobalTimersApply = (checkInEffect) => fn3(`globalTimers${checkInEffect ? "InEffect" : ""}.apply`)(function* (sourceFile, report) {
|
|
@@ -35649,7 +35708,7 @@ var instanceOfSchema = createDiagnostic({
|
|
|
35649
35708
|
if (isSchemaType._tag === "Some") {
|
|
35650
35709
|
report({
|
|
35651
35710
|
location: node,
|
|
35652
|
-
messageText: "
|
|
35711
|
+
messageText: "This code uses `instanceof` with an Effect Schema type. `Schema.is` is the schema-aware runtime check for this case.",
|
|
35653
35712
|
fixes: [{
|
|
35654
35713
|
fixName: "instanceOfSchema_fix",
|
|
35655
35714
|
description: "Replace with Schema.is",
|
|
@@ -35919,7 +35978,7 @@ var leakingRequirements = createDiagnostic({
|
|
|
35919
35978
|
location: node,
|
|
35920
35979
|
messageText: `Methods of this Service require \`${requirementsStr}\` from every caller.
|
|
35921
35980
|
|
|
35922
|
-
|
|
35981
|
+
The requirement becomes part of the public service surface instead of remaining internal to Layer implementation.
|
|
35923
35982
|
|
|
35924
35983
|
Resolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.
|
|
35925
35984
|
|
|
@@ -36116,7 +36175,7 @@ var missedPipeableOpportunity = createDiagnostic({
|
|
|
36116
36175
|
).trim() : "";
|
|
36117
36176
|
report({
|
|
36118
36177
|
location: flow2.node,
|
|
36119
|
-
messageText: `
|
|
36178
|
+
messageText: `This nested call structure has a pipeable form. \`${subjectText}.pipe(...)\` represents the same call sequence in pipe style and may be easier to read.`,
|
|
36120
36179
|
fixes: [{
|
|
36121
36180
|
fixName: "missedPipeableOpportunity_fix",
|
|
36122
36181
|
description: "Convert to pipe style",
|
|
@@ -36197,7 +36256,7 @@ var missingEffectContext = createDiagnostic({
|
|
|
36197
36256
|
(missingTypes) => missingTypes.length > 0 ? report(
|
|
36198
36257
|
{
|
|
36199
36258
|
location: node,
|
|
36200
|
-
messageText: `
|
|
36259
|
+
messageText: `This Effect requires a service that is missing from the expected Effect context: \`${sortTypes(missingTypes).map((_) => typeChecker.typeToString(_)).join(" | ")}\`.`,
|
|
36201
36260
|
fixes: []
|
|
36202
36261
|
}
|
|
36203
36262
|
) : void 0
|
|
@@ -36548,7 +36607,7 @@ var missingReturnYieldStar = createDiagnostic({
|
|
|
36548
36607
|
}];
|
|
36549
36608
|
report({
|
|
36550
36609
|
location: unwrapped,
|
|
36551
|
-
messageText:
|
|
36610
|
+
messageText: "This Effect never succeeds; using `return yield*` preserves a definitive generator exit point for type narrowing and tooling support.",
|
|
36552
36611
|
fixes: fix
|
|
36553
36612
|
});
|
|
36554
36613
|
}
|
|
@@ -36604,7 +36663,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
36604
36663
|
brokenGenerators.forEach(
|
|
36605
36664
|
(pos) => report({
|
|
36606
36665
|
location: { pos, end: pos + "function".length },
|
|
36607
|
-
messageText: `
|
|
36666
|
+
messageText: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context.",
|
|
36608
36667
|
fixes: []
|
|
36609
36668
|
})
|
|
36610
36669
|
);
|
|
@@ -36626,7 +36685,7 @@ var missingStarInYieldEffectGen = createDiagnostic({
|
|
|
36626
36685
|
}] : [];
|
|
36627
36686
|
report({
|
|
36628
36687
|
location: node,
|
|
36629
|
-
messageText: `
|
|
36688
|
+
messageText: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context.",
|
|
36630
36689
|
fixes: fix
|
|
36631
36690
|
});
|
|
36632
36691
|
});
|
|
@@ -36694,7 +36753,7 @@ var multipleEffectProvide = createDiagnostic({
|
|
|
36694
36753
|
if (chunk.length < 2) continue;
|
|
36695
36754
|
report({
|
|
36696
36755
|
location: chunk[0].node,
|
|
36697
|
-
messageText: "
|
|
36756
|
+
messageText: "This expression chains multiple `Effect.provide` calls. Providing Layers in multiple calls in a chain can break service lifecycle behavior compared with a single combined provide with merged layers.",
|
|
36698
36757
|
fixes: [{
|
|
36699
36758
|
fixName: "multipleEffectProvide_fix",
|
|
36700
36759
|
description: "Combine into a single provide",
|
|
@@ -36784,7 +36843,7 @@ var nodeBuiltinImport = createDiagnostic({
|
|
|
36784
36843
|
if (match9) {
|
|
36785
36844
|
report({
|
|
36786
36845
|
location: statement.moduleSpecifier,
|
|
36787
|
-
messageText: `
|
|
36846
|
+
messageText: `This module reference uses the \`${match9.module}\` module, the corresponding Effect API is \`${match9.alternative}\` from \`${match9.package}\`.`,
|
|
36788
36847
|
fixes: []
|
|
36789
36848
|
});
|
|
36790
36849
|
}
|
|
@@ -36797,7 +36856,7 @@ var nodeBuiltinImport = createDiagnostic({
|
|
|
36797
36856
|
if (match9) {
|
|
36798
36857
|
report({
|
|
36799
36858
|
location: arg,
|
|
36800
|
-
messageText: `
|
|
36859
|
+
messageText: `This module reference uses the \`${match9.module}\` module, the corresponding Effect API is \`${match9.alternative}\` from \`${match9.package}\`.`,
|
|
36801
36860
|
fixes: []
|
|
36802
36861
|
});
|
|
36803
36862
|
}
|
|
@@ -36851,7 +36910,7 @@ var nonObjectEffectServiceType = createDiagnostic({
|
|
|
36851
36910
|
const propertyValue = property.initializer;
|
|
36852
36911
|
const errorToReport = {
|
|
36853
36912
|
location: property.name,
|
|
36854
|
-
messageText: "Effect.Service
|
|
36913
|
+
messageText: "`Effect.Service` is declared with a primitive service type. `Effect.Service` models object-shaped services; primitive values use `Context.Tag` or `Effect.Tag` directly.",
|
|
36855
36914
|
fixes: []
|
|
36856
36915
|
};
|
|
36857
36916
|
if (propertyName === "succeed") {
|
|
@@ -37613,7 +37672,7 @@ var outdatedApi = createDiagnostic({
|
|
|
37613
37672
|
hasReported = true;
|
|
37614
37673
|
report({
|
|
37615
37674
|
location: propertyAccess.name,
|
|
37616
|
-
messageText:
|
|
37675
|
+
messageText: `This project targets Effect v4, but this code uses the Effect v3 API \`${propertyName}\`. The referenced API belongs to the v3 surface rather than the configured v4 surface.`,
|
|
37617
37676
|
fixes: []
|
|
37618
37677
|
});
|
|
37619
37678
|
}
|
|
@@ -37656,7 +37715,7 @@ var outdatedApi = createDiagnostic({
|
|
|
37656
37715
|
if (hasReported) {
|
|
37657
37716
|
report({
|
|
37658
37717
|
location: { pos: 0, end: 0 },
|
|
37659
|
-
messageText: "This project targets Effect v4, but
|
|
37718
|
+
messageText: "This project targets Effect v4, but this code uses Effect v3 APIs. The referenced API belongs to the v3 surface rather than the configured v4 surface.",
|
|
37660
37719
|
fixes: []
|
|
37661
37720
|
});
|
|
37662
37721
|
}
|
|
@@ -37832,7 +37891,7 @@ var overriddenSchemaConstructor = createDiagnostic({
|
|
|
37832
37891
|
};
|
|
37833
37892
|
report({
|
|
37834
37893
|
location: member,
|
|
37835
|
-
messageText: "
|
|
37894
|
+
messageText: "This Schema subclass defines its own constructor. For Schema classes, constructor overrides break decoding behavior for the class shape. Custom construction can be expressed through a static `new` method instead.",
|
|
37836
37895
|
fixes: (member.body ? [fixAsStaticNew] : []).concat([{
|
|
37837
37896
|
fixName: "overriddenSchemaConstructor_fix",
|
|
37838
37897
|
description: "Remove the constructor override",
|
|
@@ -37954,7 +38013,7 @@ var preferSchemaOverJson = createDiagnostic({
|
|
|
37954
38013
|
if (isSome2(match9)) {
|
|
37955
38014
|
report({
|
|
37956
38015
|
location: match9.value,
|
|
37957
|
-
messageText: "
|
|
38016
|
+
messageText: "This code uses `JSON.parse` or `JSON.stringify`. Effect Schema provides Effect-aware APIs for JSON parsing and stringifying.",
|
|
37958
38017
|
fixes: []
|
|
37959
38018
|
});
|
|
37960
38019
|
}
|
|
@@ -38072,9 +38131,7 @@ var returnEffectInGen = createDiagnostic({
|
|
|
38072
38131
|
}] : [];
|
|
38073
38132
|
report({
|
|
38074
38133
|
location: node,
|
|
38075
|
-
messageText:
|
|
38076
|
-
Maybe you wanted to return yield* instead?
|
|
38077
|
-
Nested Effect-able types may be intended if you plan to later manually flatten or unwrap this Effect, if so you can safely disable this diagnostic for this line through quickfixes.`,
|
|
38134
|
+
messageText: "This generator returns an Effect-able value directly, which produces a nested `Effect<Effect<...>>`. If the intended result is the inner Effect value, `return yield*` represents that form.",
|
|
38078
38135
|
fixes: fix
|
|
38079
38136
|
});
|
|
38080
38137
|
}),
|
|
@@ -38229,9 +38286,7 @@ var runEffectInsideEffect = createDiagnostic({
|
|
|
38229
38286
|
);
|
|
38230
38287
|
});
|
|
38231
38288
|
const v4MethodName = `${isEffectRunCall.value.methodName}With`;
|
|
38232
|
-
const messageText = supportedEffect === "v4" ?
|
|
38233
|
-
Consider extracting the current services by using for example Effect.services and then use Effect.${v4MethodName} with the extracted services instead.` : `Using ${nodeText} inside an Effect is not recommended. The same runtime should generally be used instead to run child effects.
|
|
38234
|
-
Consider extracting the Runtime by using for example Effect.runtime and then use Runtime.${isEffectRunCall.value.methodName} with the extracted runtime instead.`;
|
|
38289
|
+
const messageText = supportedEffect === "v4" ? `\`${nodeText}\` is called inside an Effect with a separate services invocation. In this context, child Effects run with the surrounding services, which can be accessed through \`Effect.services\` and \`Effect.${v4MethodName}\`.` : `\`${nodeText}\` is called inside an Effect with a separate runtime invocation. In this context, run child Effects with the surrounding runtime, which can be accessed through \`Effect.runtime\` and \`Runtime.${isEffectRunCall.value.methodName}\`.`;
|
|
38235
38290
|
report({
|
|
38236
38291
|
location: node.expression,
|
|
38237
38292
|
messageText,
|
|
@@ -38244,7 +38299,7 @@ Consider extracting the Runtime by using for example Effect.runtime and then use
|
|
|
38244
38299
|
} else {
|
|
38245
38300
|
report({
|
|
38246
38301
|
location: node.expression,
|
|
38247
|
-
messageText:
|
|
38302
|
+
messageText: `\`${nodeText}\` is called inside an existing Effect context. Here, the inner Effect can be used directly.`,
|
|
38248
38303
|
fixes: []
|
|
38249
38304
|
});
|
|
38250
38305
|
}
|
|
@@ -38299,7 +38354,7 @@ var schemaStructWithTag = createDiagnostic({
|
|
|
38299
38354
|
const otherProperties = arg.properties.filter((prop) => prop !== tagProperty);
|
|
38300
38355
|
report({
|
|
38301
38356
|
location: node,
|
|
38302
|
-
messageText: "Schema.Struct
|
|
38357
|
+
messageText: "This `Schema.Struct` includes a `_tag` field. `Schema.TaggedStruct` is the tagged-struct form for this pattern and makes the tag optional in the constructor.",
|
|
38303
38358
|
fixes: [{
|
|
38304
38359
|
fixName: "schemaStructWithTag_fix",
|
|
38305
38360
|
description: "Replace with Schema.TaggedStruct",
|
|
@@ -38392,7 +38447,7 @@ var schemaSyncInEffect = createDiagnostic({
|
|
|
38392
38447
|
const effectMethodName = syncToEffectMethod[isSchemaSyncCall.value.methodName];
|
|
38393
38448
|
report({
|
|
38394
38449
|
location: node.expression,
|
|
38395
|
-
messageText:
|
|
38450
|
+
messageText: `\`${nodeText}\` is used inside an Effect generator. \`Schema.${effectMethodName}\` preserves the typed Effect error channel for this operation without throwing.`,
|
|
38396
38451
|
fixes: []
|
|
38397
38452
|
});
|
|
38398
38453
|
}
|
|
@@ -38452,7 +38507,7 @@ var schemaUnionOfLiterals = createDiagnostic({
|
|
|
38452
38507
|
const schemaLiteralExpression = firstLiteralCall.expression;
|
|
38453
38508
|
report({
|
|
38454
38509
|
location: node,
|
|
38455
|
-
messageText: "
|
|
38510
|
+
messageText: "This `Schema.Union` contains multiple `Schema.Literal` members and can be simplified to a single `Schema.Literal` call.",
|
|
38456
38511
|
fixes: [{
|
|
38457
38512
|
fixName: "schemaUnionOfLiterals_fix",
|
|
38458
38513
|
description: "Replace with a single Schema.Literal call",
|
|
@@ -38515,8 +38570,7 @@ var scopeInLayerEffect = createDiagnostic({
|
|
|
38515
38570
|
map12(
|
|
38516
38571
|
() => report({
|
|
38517
38572
|
location: node,
|
|
38518
|
-
messageText: `
|
|
38519
|
-
Consider using "scoped" instead to get rid of the scope in the requirements.`,
|
|
38573
|
+
messageText: "This layer construction leaves `Scope` in the requirement set. The scoped API removes `Scope` from the resulting requirements.",
|
|
38520
38574
|
fixes: methodIdentifier ? [{
|
|
38521
38575
|
fixName: "scopeInLayerEffect_scoped",
|
|
38522
38576
|
description: "Use scoped for Layer creation",
|
|
@@ -38616,7 +38670,7 @@ var serviceNotAsClass = createDiagnostic({
|
|
|
38616
38670
|
const shapeText = typeArgs.length > 0 ? typeArgs.map((t) => sourceFile.text.substring(ts.getTokenPosOfNode(t, sourceFile), t.end)).join(", ") : "Shape";
|
|
38617
38671
|
report({
|
|
38618
38672
|
location: callExpr,
|
|
38619
|
-
messageText:
|
|
38673
|
+
messageText: `\`ServiceMap.Service\` is assigned to a variable here, but this API is intended for a class declaration shape such as \`class ${variableName} extends ServiceMap.Service<${variableName}, ${shapeText}>()("${argsText.replace(/['"]/g, "")}") {}\`.`,
|
|
38620
38674
|
fixes: [{
|
|
38621
38675
|
fixName: "serviceNotAsClass",
|
|
38622
38676
|
description: `Convert to class declaration`,
|
|
@@ -38829,7 +38883,7 @@ var tryCatchInEffectGen = createDiagnostic({
|
|
|
38829
38883
|
map12(() => {
|
|
38830
38884
|
report({
|
|
38831
38885
|
location: node,
|
|
38832
|
-
messageText: `
|
|
38886
|
+
messageText: `This Effect generator contains \`try/catch\`; in this context, error handling is expressed with Effect APIs such as ${alternatives.join(", ")}).`,
|
|
38833
38887
|
fixes: []
|
|
38834
38888
|
});
|
|
38835
38889
|
}),
|
|
@@ -38890,8 +38944,7 @@ var unknownInEffectCatch = createDiagnostic({
|
|
|
38890
38944
|
);
|
|
38891
38945
|
report({
|
|
38892
38946
|
location: node.expression,
|
|
38893
|
-
messageText: `The
|
|
38894
|
-
Consider wrapping unknown errors into Effect's Data.TaggedError for example, or narrow down the type to the specific error raised.`,
|
|
38947
|
+
messageText: `The \`catch\` callback in \`${nodeText}\` returns \`unknown\`, so the Effect error type stays untyped. A specific typed error preserves error-channel information, for example by narrowing the value or wrapping it in \`Data.TaggedError\`.`,
|
|
38895
38948
|
fixes: []
|
|
38896
38949
|
});
|
|
38897
38950
|
}
|
|
@@ -38988,7 +39041,7 @@ var unnecessaryFailYieldableError = createDiagnostic({
|
|
|
38988
39041
|
map12(
|
|
38989
39042
|
() => report({
|
|
38990
39043
|
location: node,
|
|
38991
|
-
messageText:
|
|
39044
|
+
messageText: "This `yield* Effect.fail(...)` passes a yieldable error value. `yield*` represents that value directly without wrapping it in `Effect.fail`.",
|
|
38992
39045
|
fixes: [{
|
|
38993
39046
|
fixName: "unnecessaryFailYieldableError_fix",
|
|
38994
39047
|
description: "Replace yield* Effect.fail with yield*",
|
|
@@ -39093,7 +39146,7 @@ var unnecessaryPipeChain = createDiagnostic({
|
|
|
39093
39146
|
map12(({ innerCall, pipeCall }) => {
|
|
39094
39147
|
report({
|
|
39095
39148
|
location: node,
|
|
39096
|
-
messageText: `
|
|
39149
|
+
messageText: "This expression contains chained `pipe` calls that can be simplified to a single `pipe` call.",
|
|
39097
39150
|
fixes: [{
|
|
39098
39151
|
fixName: "unnecessaryPipeChain_fix",
|
|
39099
39152
|
description: "Rewrite as single pipe call",
|
|
@@ -39363,7 +39416,7 @@ var metadata_default = {
|
|
|
39363
39416
|
{
|
|
39364
39417
|
start: 154,
|
|
39365
39418
|
end: 169,
|
|
39366
|
-
text: "Self type parameter should be
|
|
39419
|
+
text: "The `Self` type parameter for this class should be `InvalidContextTag`. effect(classSelfMismatch)"
|
|
39367
39420
|
}
|
|
39368
39421
|
]
|
|
39369
39422
|
}
|
|
@@ -39399,7 +39452,7 @@ var metadata_default = {
|
|
|
39399
39452
|
{
|
|
39400
39453
|
start: 86,
|
|
39401
39454
|
end: 91,
|
|
39402
|
-
text: "Parameter
|
|
39455
|
+
text: "Parameter `input` implicitly has type `any` in `Effect.fn`, `Effect.fnUntraced`, or `Effect.fnUntracedEager`. No parameter type is available from an explicit annotation or contextual function type. effect(effectFnImplicitAny)"
|
|
39403
39456
|
}
|
|
39404
39457
|
]
|
|
39405
39458
|
}
|
|
@@ -39420,7 +39473,7 @@ var metadata_default = {
|
|
|
39420
39473
|
{
|
|
39421
39474
|
start: 41,
|
|
39422
39475
|
end: 64,
|
|
39423
|
-
text: "Effect
|
|
39476
|
+
text: "This Effect value is neither yielded nor used in an assignment. effect(floatingEffect)"
|
|
39424
39477
|
}
|
|
39425
39478
|
]
|
|
39426
39479
|
}
|
|
@@ -39462,7 +39515,7 @@ var metadata_default = {
|
|
|
39462
39515
|
{
|
|
39463
39516
|
start: 160,
|
|
39464
39517
|
end: 167,
|
|
39465
|
-
text: "
|
|
39518
|
+
text: "This Effect requires a service that is missing from the expected Effect context: `Db`. effect(missingEffectContext)"
|
|
39466
39519
|
}
|
|
39467
39520
|
]
|
|
39468
39521
|
}
|
|
@@ -39525,7 +39578,7 @@ var metadata_default = {
|
|
|
39525
39578
|
{
|
|
39526
39579
|
start: 121,
|
|
39527
39580
|
end: 147,
|
|
39528
|
-
text: "
|
|
39581
|
+
text: "This Effect never succeeds; using `return yield*` preserves a definitive generator exit point for type narrowing and tooling support. effect(missingReturnYieldStar)"
|
|
39529
39582
|
}
|
|
39530
39583
|
]
|
|
39531
39584
|
}
|
|
@@ -39546,12 +39599,12 @@ var metadata_default = {
|
|
|
39546
39599
|
{
|
|
39547
39600
|
start: 75,
|
|
39548
39601
|
end: 83,
|
|
39549
|
-
text: "
|
|
39602
|
+
text: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context. effect(missingStarInYieldEffectGen)"
|
|
39550
39603
|
},
|
|
39551
39604
|
{
|
|
39552
39605
|
start: 105,
|
|
39553
39606
|
end: 128,
|
|
39554
|
-
text: "
|
|
39607
|
+
text: "This uses `yield` for an `Effect` value. `yield*` is the Effect-aware form in this context. effect(missingStarInYieldEffectGen)"
|
|
39555
39608
|
}
|
|
39556
39609
|
]
|
|
39557
39610
|
}
|
|
@@ -39571,7 +39624,7 @@ var metadata_default = {
|
|
|
39571
39624
|
{
|
|
39572
39625
|
start: 142,
|
|
39573
39626
|
end: 149,
|
|
39574
|
-
text: "Effect.Service
|
|
39627
|
+
text: "`Effect.Service` is declared with a primitive service type. `Effect.Service` models object-shaped services; primitive values use `Context.Tag` or `Effect.Tag` directly. effect(nonObjectEffectServiceType)"
|
|
39575
39628
|
}
|
|
39576
39629
|
]
|
|
39577
39630
|
}
|
|
@@ -39591,12 +39644,12 @@ var metadata_default = {
|
|
|
39591
39644
|
{
|
|
39592
39645
|
start: 0,
|
|
39593
39646
|
end: 0,
|
|
39594
|
-
text: "This project targets Effect v4, but
|
|
39647
|
+
text: "This project targets Effect v4, but this code uses Effect v3 APIs. The referenced API belongs to the v3 surface rather than the configured v4 surface. effect(outdatedApi)"
|
|
39595
39648
|
},
|
|
39596
39649
|
{
|
|
39597
39650
|
start: 126,
|
|
39598
39651
|
end: 133,
|
|
39599
|
-
text: "
|
|
39652
|
+
text: "This project targets Effect v4, but this code uses the Effect v3 API `runtime`. The referenced API belongs to the v3 surface rather than the configured v4 surface. effect(outdatedApi)"
|
|
39600
39653
|
}
|
|
39601
39654
|
]
|
|
39602
39655
|
}
|
|
@@ -39638,7 +39691,7 @@ var metadata_default = {
|
|
|
39638
39691
|
{
|
|
39639
39692
|
start: 123,
|
|
39640
39693
|
end: 185,
|
|
39641
|
-
text: "
|
|
39694
|
+
text: "This Schema subclass defines its own constructor. For Schema classes, constructor overrides break decoding behavior for the class shape. Custom construction can be expressed through a static `new` method instead. effect(overriddenSchemaConstructor)"
|
|
39642
39695
|
}
|
|
39643
39696
|
]
|
|
39644
39697
|
}
|
|
@@ -39680,7 +39733,7 @@ var metadata_default = {
|
|
|
39680
39733
|
{
|
|
39681
39734
|
start: 82,
|
|
39682
39735
|
end: 94,
|
|
39683
|
-
text: "
|
|
39736
|
+
text: "The previous Effect does not fail, so this error-handling branch will never run. effect(catchUnfailableEffect)"
|
|
39684
39737
|
}
|
|
39685
39738
|
]
|
|
39686
39739
|
}
|
|
@@ -39701,7 +39754,7 @@ var metadata_default = {
|
|
|
39701
39754
|
{
|
|
39702
39755
|
start: 64,
|
|
39703
39756
|
end: 137,
|
|
39704
|
-
text: `Effect.fn returns a reusable function that can take arguments, but
|
|
39757
|
+
text: '`Effect.fn` returns a reusable function that can take arguments, but it is invoked immediately here. `Effect.gen` represents the immediate-use form for this pattern with `Effect.withSpan("preview")` piped at the end to maintain tracing spans. effect(effectFnIife)'
|
|
39705
39758
|
}
|
|
39706
39759
|
]
|
|
39707
39760
|
}
|
|
@@ -39790,7 +39843,7 @@ var metadata_default = {
|
|
|
39790
39843
|
{
|
|
39791
39844
|
start: 56,
|
|
39792
39845
|
end: 73,
|
|
39793
|
-
text: "The
|
|
39846
|
+
text: "The `catch` callback in `Effect.tryPromise` returns the global `Error` type. Untagged errors merge together in the Effect error channel and lose type-level distinction; a tagged error preserves that distinction and can wrap the original error in a `cause` property. effect(globalErrorInEffectCatch)"
|
|
39794
39847
|
}
|
|
39795
39848
|
]
|
|
39796
39849
|
}
|
|
@@ -39853,7 +39906,7 @@ var metadata_default = {
|
|
|
39853
39906
|
{
|
|
39854
39907
|
start: 212,
|
|
39855
39908
|
end: 217,
|
|
39856
|
-
text: "Methods of this Service require `FileSystem` from every caller.\n\
|
|
39909
|
+
text: "Methods of this Service require `FileSystem` from every caller.\n\nThe requirement becomes part of the public service surface instead of remaining internal to Layer implementation.\n\nResolve these dependencies at Layer creation and provide them to each method, so the service's type reflects its purpose, not its implementation.\n\nTo suppress this diagnostic for specific dependency types that are intentionally passed through (e.g., HttpServerRequest), add `@effect-leakable-service` JSDoc to their interface declarations (e.g., the `FileSystem` interface), or to this service by adding a `@effect-expect-leaking FileSystem` JSDoc.\n\nMore info and examples at https://effect.website/docs/requirements-management/layers/#avoiding-requirement-leakage effect(leakingRequirements)"
|
|
39857
39910
|
}
|
|
39858
39911
|
]
|
|
39859
39912
|
}
|
|
@@ -39874,7 +39927,7 @@ var metadata_default = {
|
|
|
39874
39927
|
{
|
|
39875
39928
|
start: 348,
|
|
39876
39929
|
end: 373,
|
|
39877
|
-
text: "
|
|
39930
|
+
text: "This expression chains multiple `Effect.provide` calls. Providing Layers in multiple calls in a chain can break service lifecycle behavior compared with a single combined provide with merged layers. effect(multipleEffectProvide)"
|
|
39878
39931
|
}
|
|
39879
39932
|
]
|
|
39880
39933
|
}
|
|
@@ -39895,7 +39948,7 @@ var metadata_default = {
|
|
|
39895
39948
|
{
|
|
39896
39949
|
start: 91,
|
|
39897
39950
|
end: 115,
|
|
39898
|
-
text: "
|
|
39951
|
+
text: "This generator returns an Effect-able value directly, which produces a nested `Effect<Effect<...>>`. If the intended result is the inner Effect value, `return yield*` represents that form. effect(returnEffectInGen)"
|
|
39899
39952
|
}
|
|
39900
39953
|
]
|
|
39901
39954
|
}
|
|
@@ -39916,7 +39969,7 @@ var metadata_default = {
|
|
|
39916
39969
|
{
|
|
39917
39970
|
start: 101,
|
|
39918
39971
|
end: 115,
|
|
39919
|
-
text: "
|
|
39972
|
+
text: "`Effect.runSync` is called inside an Effect with a separate services invocation. In this context, child Effects run with the surrounding services, which can be accessed through `Effect.services` and `Effect.runSyncWith`. effect(runEffectInsideEffect)"
|
|
39920
39973
|
}
|
|
39921
39974
|
]
|
|
39922
39975
|
}
|
|
@@ -39936,7 +39989,7 @@ var metadata_default = {
|
|
|
39936
39989
|
{
|
|
39937
39990
|
start: 276,
|
|
39938
39991
|
end: 293,
|
|
39939
|
-
text: "
|
|
39992
|
+
text: "`Schema.decodeSync` is used inside an Effect generator. `Schema.decode` preserves the typed Effect error channel for this operation without throwing. effect(schemaSyncInEffect)"
|
|
39940
39993
|
}
|
|
39941
39994
|
]
|
|
39942
39995
|
}
|
|
@@ -39956,7 +40009,7 @@ var metadata_default = {
|
|
|
39956
40009
|
{
|
|
39957
40010
|
start: 211,
|
|
39958
40011
|
end: 338,
|
|
39959
|
-
text:
|
|
40012
|
+
text: "This layer construction leaves `Scope` in the requirement set. The scoped API removes `Scope` from the resulting requirements. effect(scopeInLayerEffect)"
|
|
39960
40013
|
}
|
|
39961
40014
|
]
|
|
39962
40015
|
}
|
|
@@ -39998,7 +40051,7 @@ var metadata_default = {
|
|
|
39998
40051
|
{
|
|
39999
40052
|
start: 91,
|
|
40000
40053
|
end: 151,
|
|
40001
|
-
text: "
|
|
40054
|
+
text: "This Effect generator contains `try/catch`; in this context, error handling is expressed with Effect APIs such as Effect.try, Effect.tryPromise, Effect.catch, Effect.catchTag). effect(tryCatchInEffectGen)"
|
|
40002
40055
|
}
|
|
40003
40056
|
]
|
|
40004
40057
|
}
|
|
@@ -40019,7 +40072,7 @@ var metadata_default = {
|
|
|
40019
40072
|
{
|
|
40020
40073
|
start: 56,
|
|
40021
40074
|
end: 73,
|
|
40022
|
-
text: "The
|
|
40075
|
+
text: "The `catch` callback in `Effect.tryPromise` returns `unknown`, so the Effect error type stays untyped. A specific typed error preserves error-channel information, for example by narrowing the value or wrapping it in `Data.TaggedError`. effect(unknownInEffectCatch)"
|
|
40023
40076
|
}
|
|
40024
40077
|
]
|
|
40025
40078
|
}
|
|
@@ -40040,7 +40093,7 @@ var metadata_default = {
|
|
|
40040
40093
|
{
|
|
40041
40094
|
start: 14,
|
|
40042
40095
|
end: 26,
|
|
40043
|
-
text: "
|
|
40096
|
+
text: "This class extends the native `Error` type directly. Untagged native errors lose distinction in the Effect failure channel. effect(extendsNativeError)"
|
|
40044
40097
|
}
|
|
40045
40098
|
]
|
|
40046
40099
|
}
|
|
@@ -40061,7 +40114,7 @@ var metadata_default = {
|
|
|
40061
40114
|
{
|
|
40062
40115
|
start: 1,
|
|
40063
40116
|
end: 23,
|
|
40064
|
-
text: "
|
|
40117
|
+
text: "This code uses `console.log`, the corresponding Effect logging API is `Effect.log or Logger`. effect(globalConsole)"
|
|
40065
40118
|
}
|
|
40066
40119
|
]
|
|
40067
40120
|
}
|
|
@@ -40082,7 +40135,7 @@ var metadata_default = {
|
|
|
40082
40135
|
{
|
|
40083
40136
|
start: 83,
|
|
40084
40137
|
end: 103,
|
|
40085
|
-
text: "
|
|
40138
|
+
text: "This Effect code uses `console.log`, logging in Effect code is represented through `Effect.log or Logger`. effect(globalConsoleInEffect)"
|
|
40086
40139
|
}
|
|
40087
40140
|
]
|
|
40088
40141
|
}
|
|
@@ -40103,7 +40156,7 @@ var metadata_default = {
|
|
|
40103
40156
|
{
|
|
40104
40157
|
start: 24,
|
|
40105
40158
|
end: 34,
|
|
40106
|
-
text: "
|
|
40159
|
+
text: "This code uses `Date.now()`, time access is represented through `Clock` from Effect. effect(globalDate)"
|
|
40107
40160
|
}
|
|
40108
40161
|
]
|
|
40109
40162
|
}
|
|
@@ -40124,7 +40177,7 @@ var metadata_default = {
|
|
|
40124
40177
|
{
|
|
40125
40178
|
start: 95,
|
|
40126
40179
|
end: 105,
|
|
40127
|
-
text: "
|
|
40180
|
+
text: "This Effect code uses `Date.now()`, time access in Effect code is represented through `Clock` from Effect. effect(globalDateInEffect)"
|
|
40128
40181
|
}
|
|
40129
40182
|
]
|
|
40130
40183
|
}
|
|
@@ -40145,7 +40198,7 @@ var metadata_default = {
|
|
|
40145
40198
|
{
|
|
40146
40199
|
start: 24,
|
|
40147
40200
|
end: 29,
|
|
40148
|
-
text: "
|
|
40201
|
+
text: "This code uses the global `fetch` function, HTTP requests are represented through `HttpClient` from `@effect/platform`. effect(globalFetch)"
|
|
40149
40202
|
}
|
|
40150
40203
|
]
|
|
40151
40204
|
}
|
|
@@ -40181,7 +40234,7 @@ var metadata_default = {
|
|
|
40181
40234
|
{
|
|
40182
40235
|
start: 24,
|
|
40183
40236
|
end: 37,
|
|
40184
|
-
text: "
|
|
40237
|
+
text: "This code uses `Math.random()`, randomness is represented through the Effect `Random` service. effect(globalRandom)"
|
|
40185
40238
|
}
|
|
40186
40239
|
]
|
|
40187
40240
|
}
|
|
@@ -40202,7 +40255,7 @@ var metadata_default = {
|
|
|
40202
40255
|
{
|
|
40203
40256
|
start: 93,
|
|
40204
40257
|
end: 106,
|
|
40205
|
-
text: "
|
|
40258
|
+
text: "This Effect code uses `Math.random()`, randomness is represented through the Effect `Random` service. effect(globalRandomInEffect)"
|
|
40206
40259
|
}
|
|
40207
40260
|
]
|
|
40208
40261
|
}
|
|
@@ -40223,7 +40276,7 @@ var metadata_default = {
|
|
|
40223
40276
|
{
|
|
40224
40277
|
start: 1,
|
|
40225
40278
|
end: 26,
|
|
40226
|
-
text: "
|
|
40279
|
+
text: "This code uses `setTimeout`, the corresponding Effect timer API is `Effect.sleep or Schedule` from Effect. effect(globalTimers)"
|
|
40227
40280
|
}
|
|
40228
40281
|
]
|
|
40229
40282
|
}
|
|
@@ -40244,7 +40297,7 @@ var metadata_default = {
|
|
|
40244
40297
|
{
|
|
40245
40298
|
start: 83,
|
|
40246
40299
|
end: 108,
|
|
40247
|
-
text: "
|
|
40300
|
+
text: "This Effect code uses `setTimeout`, the corresponding timer API in this context is `Effect.sleep or Schedule` from Effect. effect(globalTimersInEffect)"
|
|
40248
40301
|
}
|
|
40249
40302
|
]
|
|
40250
40303
|
}
|
|
@@ -40265,7 +40318,7 @@ var metadata_default = {
|
|
|
40265
40318
|
{
|
|
40266
40319
|
start: 159,
|
|
40267
40320
|
end: 180,
|
|
40268
|
-
text: "
|
|
40321
|
+
text: "This code uses `instanceof` with an Effect Schema type. `Schema.is` is the schema-aware runtime check for this case. effect(instanceOfSchema)"
|
|
40269
40322
|
}
|
|
40270
40323
|
]
|
|
40271
40324
|
}
|
|
@@ -40286,7 +40339,7 @@ var metadata_default = {
|
|
|
40286
40339
|
{
|
|
40287
40340
|
start: 15,
|
|
40288
40341
|
end: 24,
|
|
40289
|
-
text: "
|
|
40342
|
+
text: "This module reference uses the `fs` module, the corresponding Effect API is `FileSystem` from `@effect/platform`. effect(nodeBuiltinImport)"
|
|
40290
40343
|
}
|
|
40291
40344
|
]
|
|
40292
40345
|
}
|
|
@@ -40313,7 +40366,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40313
40366
|
{
|
|
40314
40367
|
start: 142,
|
|
40315
40368
|
end: 158,
|
|
40316
|
-
text: "
|
|
40369
|
+
text: "This code uses `JSON.parse` or `JSON.stringify`. Effect Schema provides Effect-aware APIs for JSON parsing and stringifying. effect(preferSchemaOverJson)"
|
|
40317
40370
|
}
|
|
40318
40371
|
]
|
|
40319
40372
|
}
|
|
@@ -40334,7 +40387,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40334
40387
|
{
|
|
40335
40388
|
start: 150,
|
|
40336
40389
|
end: 162,
|
|
40337
|
-
text: "
|
|
40390
|
+
text: "`Effect.mapError` expresses the same error-type transformation more directly than `Effect.catch` followed by `Effect.fail`. effect(catchAllToMapError)"
|
|
40338
40391
|
}
|
|
40339
40392
|
]
|
|
40340
40393
|
}
|
|
@@ -40355,7 +40408,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40355
40408
|
{
|
|
40356
40409
|
start: 116,
|
|
40357
40410
|
end: 134,
|
|
40358
|
-
text: "
|
|
40411
|
+
text: "This key does not match the deterministic key for this declaration. The expected key is `@effect/harness-effect-v4/examples/diagnostics/deterministicKeys_preview/RenamedService`. effect(deterministicKeys)"
|
|
40359
40412
|
}
|
|
40360
40413
|
]
|
|
40361
40414
|
}
|
|
@@ -40376,7 +40429,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40376
40429
|
{
|
|
40377
40430
|
start: 54,
|
|
40378
40431
|
end: 61,
|
|
40379
|
-
text: "
|
|
40432
|
+
text: "This expression can be rewritten in the reusable function form `Effect.fn(function*() { ... })`. effect(effectFnOpportunity)"
|
|
40380
40433
|
}
|
|
40381
40434
|
]
|
|
40382
40435
|
}
|
|
@@ -40397,7 +40450,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40397
40450
|
{
|
|
40398
40451
|
start: 82,
|
|
40399
40452
|
end: 92,
|
|
40400
|
-
text: "
|
|
40453
|
+
text: "This expression discards the success value through mapping. `Effect.asVoid` represents that form directly. effect(effectMapVoid)"
|
|
40401
40454
|
}
|
|
40402
40455
|
]
|
|
40403
40456
|
}
|
|
@@ -40418,7 +40471,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40418
40471
|
{
|
|
40419
40472
|
start: 56,
|
|
40420
40473
|
end: 81,
|
|
40421
|
-
text: "Effect.void
|
|
40474
|
+
text: "`Effect.void` represents the same outcome as `Effect.succeed(undefined)` or `Effect.succeed(void 0)`. effect(effectSucceedWithVoid)"
|
|
40422
40475
|
}
|
|
40423
40476
|
]
|
|
40424
40477
|
}
|
|
@@ -40460,7 +40513,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40460
40513
|
{
|
|
40461
40514
|
start: 116,
|
|
40462
40515
|
end: 172,
|
|
40463
|
-
text: "
|
|
40516
|
+
text: "This nested call structure has a pipeable form. `Schema.decodeEffect(User)({ id: 1 }).pipe(...)` represents the same call sequence in pipe style and may be easier to read. effect(missedPipeableOpportunity)"
|
|
40464
40517
|
}
|
|
40465
40518
|
]
|
|
40466
40519
|
}
|
|
@@ -40522,7 +40575,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40522
40575
|
{
|
|
40523
40576
|
start: 64,
|
|
40524
40577
|
end: 136,
|
|
40525
|
-
text: "Schema.Struct
|
|
40578
|
+
text: "This `Schema.Struct` includes a `_tag` field. `Schema.TaggedStruct` is the tagged-struct form for this pattern and makes the tag optional in the constructor. effect(schemaStructWithTag)"
|
|
40526
40579
|
}
|
|
40527
40580
|
]
|
|
40528
40581
|
}
|
|
@@ -40542,7 +40595,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40542
40595
|
{
|
|
40543
40596
|
start: 64,
|
|
40544
40597
|
end: 118,
|
|
40545
|
-
text: "
|
|
40598
|
+
text: "This `Schema.Union` contains multiple `Schema.Literal` members and can be simplified to a single `Schema.Literal` call. effect(schemaUnionOfLiterals)"
|
|
40546
40599
|
}
|
|
40547
40600
|
]
|
|
40548
40601
|
}
|
|
@@ -40562,7 +40615,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40562
40615
|
{
|
|
40563
40616
|
start: 60,
|
|
40564
40617
|
end: 107,
|
|
40565
|
-
text: 'ServiceMap.Service
|
|
40618
|
+
text: '`ServiceMap.Service` is assigned to a variable here, but this API is intended for a class declaration shape such as `class Preview extends ServiceMap.Service<Preview, { port: number }>()("Preview") {}`. effect(serviceNotAsClass)'
|
|
40566
40619
|
}
|
|
40567
40620
|
]
|
|
40568
40621
|
}
|
|
@@ -40630,7 +40683,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40630
40683
|
{
|
|
40631
40684
|
start: 178,
|
|
40632
40685
|
end: 208,
|
|
40633
|
-
text: "This Effect.fail
|
|
40686
|
+
text: "This `yield* Effect.fail(...)` passes a yieldable error value. `yield*` represents that value directly without wrapping it in `Effect.fail`. effect(unnecessaryFailYieldableError)"
|
|
40634
40687
|
}
|
|
40635
40688
|
]
|
|
40636
40689
|
}
|
|
@@ -40672,7 +40725,7 @@ export const preview = Effect.gen(function*() {
|
|
|
40672
40725
|
{
|
|
40673
40726
|
start: 64,
|
|
40674
40727
|
end: 125,
|
|
40675
|
-
text: "
|
|
40728
|
+
text: "This expression contains chained `pipe` calls that can be simplified to a single `pipe` call. effect(unnecessaryPipeChain)"
|
|
40676
40729
|
}
|
|
40677
40730
|
]
|
|
40678
40731
|
}
|