Repository navigation
@effect/tsgo@0.52.0
Minor Changes
-
3e4a55d: Route Effect contextual-type queries through
TypeParser.GetContextualTypeand enforce the wrapper with customlint. For example, usetp.GetContextualType(node, checker.ContextFlagsNone)instead of the checker method. Query behavior stays unchanged, with one place to add contextual-type safety guards in future changes. -
0269634: Add
effectSleepZeroToYieldNow, a style suggestion with a quick fix for zero-durationEffect.sleepcalls.For example,
Effect.sleep(0)becomesEffect.yieldNow()in Effect v3 andEffect.yieldNowin Effect v4. The rule also recognizes safe zero-duration strings, tuples, and Duration constructors. The replacement yields through the fiber scheduler instead of the Clock service. -
181b2b3: Add the
flatMapToTapstyle suggestion and quick fix for Effect v3 and v4. Callbacks that run an effect and restore their unchanged parameter with terminalEffect.asorEffect.mapcan useEffect.tapinstead. The fix preserves callback statements and earlier effect transformations. -
7d051dd: Route internal symbol and type location queries through TypeParser and enforce this with customlint. Reuse the existing TypeParser throughout pipeable signature comparison.
Prevent false TS2790 diagnostics for valid index-signature deletes such as
declare const map: { [key: string]: number }; delete map.x;. Symbol queries skip deleted property accesses and their names, including parenthesized and optional targets. Receiver and computed-key queries remain available, and invalid required-property and readonly deletes still report compiler errors. -
f178ff2: Add the opt-in
preferEffectArraydiagnostic ineffectNativefor native Array method calls and references. It suggests 16 corresponding Effect Array APIs and explains migration differences, such asvalues.find(predicate)becomingArray.findFirst(values, predicate)with anOptionresult.The rule is disabled by default and enabled as a warning by the
effect-nativepreset. It supports readonly arrays, tuples, aliases, and literal bracket access. Native Array recognition uses a lazy cache shared per checker. Conversion autofixes are not included. -
f59b4b8: Add the opt-in
preferEffectRecorddiagnostic ineffectNativefor native Object calls and references. It suggestsRecord.keys,Record.values,Record.toEntries,Record.fromEntries, andRecord.has, including nativehasOwnPropertyreferences.Each suggestion explains input typing or runtime differences. For example,
Object.entries(data)suggestsRecord.toEntries(data)with typed keys and a caveat about getter or proxy mutations.data.hasOwnProperty(key)suggests passing the receiver explicitly toRecord.has(data, key).The rule defaults to off and the
effect-nativepreset enables it as a warning. Both Effect v3 and v4 are supported. Only suppression quick fixes are available. -
2672190: Add the opt-in
preferSchemaTaggedErrordiagnostic for Effect v3 and v4. It suggestsSchema.TaggedErrorfor class declarations that extendData.TaggedError, including anonymous default exports. For example,class NotFound extends Data.TaggedError("NotFound")<{ id: string }> {}reports a warning when the rule is enabled. -
ab20f55: Expose parser results through getters and readonly collection views. For Go consumers,
result.Abecomesresult.A(), andflow.Transformations[i]becomesflow.Transformations().At(i). Collection views support iteration and explicit owned copies. Compiler AST and type pointers remain borrowed. -
c4aa628: Include
{ readonly brand: unique symbol }in Effect v4 Schema class completions forClass,TaggedClass,Error, andTaggedError. Add a branded completion forSchema.Opaque.For example, the
Class<Person>completion insertsSchema.Class<Person, { readonly brand: unique symbol }>("Person"). Effect v3 andModel.Classcompletions keep their existing type arguments. -
22f6106: Add
schemaClassMissingBrand, a correctness suggestion enabled by default for Effect v4 schema classes, errors, and opaque classes.The diagnostic suggests adding a brand when the second brand type argument is omitted. For example,
Schema.Class<Person>("Person")triggers a suggestion, whileSchema.Class<Person, { readonly brand: unique symbol }>("Person")supplies a nominal brand. An explicit{}keeps structural typing and suppresses the suggestion. Effect v3 is excluded. -
d565ab8: Recognize
Predicate.isTagged(value, "Foo")andPredicate.isTagged("Foo")(value)as tag comparisons in dispatch analysis. Existing catch-tag diagnostics and quick fixes now handle both forms in Effect v3 and v4.
Patch Changes
-
4ceb27f: Reduce repeated type inference when checking experimental and unstable properties in generic object literals.
-
e57688f: Clear an inherited Effect plugin when a child
tsconfigdefines an empty or replacementpluginslist. -
9696634: Report experimental and unstable properties supplied in contextually typed object literals, including shorthand properties. For example,
x({ test: 42 })andx({ test })now warn when the parameter type markstestwith@stability experimental, even if the function and interface are stable. -
0dfc0be: Fix a crash in the "Convert to Effect.fn" refactor when
genis a named import or a local alias.import { gen } from "effect/Effect" export const foo = () => gen(function*() { return 1 })
Requesting code actions on
genused to fail the wholetextDocument/codeActionrequest with a nil pointer panic. The refactor now rewrites toEffect.fn, using the file's existing Effect import name when there is one:import { gen } from "effect/Effect" export const foo = Effect.fn("foo")(function* () { return 1; });
The refactor does not add a missing
Effectimport. The user adds it. -
6107975: Update the shim generator's Go tools dependency to support Go 1.27.2 export data and restore compiler setup.
Preserve pointers to unexported structs in generated shim mirrors so fields that follow them retain their offsets and accessors return the correct values.
-
8e0b5bf: Resolve the types carried by typeparser results only when a rule reads them, and reuse the resolved type on later reads. For example, a piping flow no longer queries the type of every transformation up front, so a rule that filters flows by callee skips those queries. Diagnostics are unchanged.
-
6512cfb: Cache module export checks per symbol. Rules check whether most identifiers and callees refer to a module export, such as
gen,fn, ormapfrom theeffectpackage'sEffectmodule. Each symbol now gets a slot in a paged array indexed by symbol id, the layout the TypeScript 7.1 checker uses for its own symbol caches. The slot holds a small map of answers keyed by module and member name. Before, every answer shared one large hash map. For example,tsc -bon the Effect monorepo with every rule enabled runs about 1% faster with identical diagnostics. On TypeScript 7.0.2, which lacks block-allocated symbol ids, the per-symbol slots stay in a hash map. -
b780f66: Fix the Effect.fn and async-to-Effect refactors for functions nested inside another declaration's value. A function in a catch binding default no longer makes the code action request fail, and a function in an object, array, call argument, class field, or later declarator is now replaced in place instead of overwriting the whole value. For example, converting
taskinexport const inObject = { task: () => Effect.gen(function*() { return 1 }) }now producesexport const inObject = { task: Effect.fn(function* () { return 1; }) }. -
959570b: Store the Effect caches that cover most nodes of a file in paged arrays indexed by node id, the layout the TypeScript 7.1 checker uses for its own hottest node caches. A lookup now indexes an array instead of hashing a node pointer. For example,
tsc -bon the Effect monorepo runs about 2% faster with identical diagnostics. On TypeScript 7.0.2, which lacks block-allocated node ids, these caches stay hash maps. -
60eac10: Run Effect diagnostics after TypeScript checks unused identifiers so plugin symbol queries cannot suppress TS6133. For example, with
noUnusedParametersenabled,export function unusedPredicate(value: unknown): value is number { return true; }now reports the unusedvalueparameter with the plugin enabled, just as it does with the plugin disabled. -
7450a52: Remove the
debugplugin option and the debug-onlyFlowsgroup from the document outline. -
3e4a55d: Cache object-literal contextual types per checker across experimental and unstable API diagnostics. Keep normal and inference-blocked queries separate, including nil results, to avoid repeating the same contextual-type queries.
-
4d9fba4: Ship the latest TypeScript compiler once in each platform package. It was packaged twice, as
lib/tscand asartifacts/typescript/<latest>/tsc, each with its ownlib.*.d.tsfiles. It now ships only aslib/tsc, which makes@effect/tsgo-darwin-arm6429 MB smaller unpacked.get-exe-path,diagnostics,patchandgetExePath()resolve the latest TypeScript version tolib/tscand other versions toartifacts/typescript/<version>/tsc. Tools that runlib/tscdirectly keep working. -
3e4a55d: Prevent false TypeScript iterator and object-spread diagnostics when experimental or unstable API checks query generic constraints inside inferred generator function expressions. Skip inference-blocked contextual queries in these expressions while retaining normal contextual lookups. This conservative fallback can omit constraint-based property warnings inside inferred generators.
-
da2f46d: Skip type queries for expressions that can never have an Effect library type, such as literals, functions and, on Effect v4, plain object literals. Diagnostics are unchanged, but they are cheaper to compute: on the Effect monorepo a
tsc -bbuild is about 1.3s faster with the default rules and about 2.4s faster with every rule exceptapiStabilityLeakenabled.For example, rules such as
effectInVoidSuccessno longer ask the checker for the type of the array and object literal arguments here, because neither can be an Effect:Effect.forEach([1, 2, 3], (n) => Effect.log(n), { concurrency: 2 })
-
1c7cbf9: Update Effect v4 dependencies and test fixtures from
4.0.0-rc.118to stable4.0.2. Align@effect/platform-node,@effect/platform-node-shared, and@effect/vitestwith the same release. -
fea53cc: Use the configured
keyPatternsforData.TaggedErrorandSchema.TaggedErrorcompletions, so the inserted tag already matches the key expected bydeterministicKeys.For example, with
{ "target": "error", "pattern": "package-identifier" }inkeyPatterns, completingclass NotFound extends Data.insrc/errors.tsof package@app/corenow insertsData.TaggedError("@app/core/errors/NotFound")<{}>{}instead ofData.TaggedError("NotFound")<{}>{}. Without anerrorkey pattern the completion still uses the class name. -
cb7567e: Support both field-based and method-based compiler symbols through generated shim helpers.
-
7450a52: Update the TypeScript next tag to
typescript@next, which shipstypescript-gocommitd61a7d235906e78be9b111de0ba060e28e67ecfa, and update the TypeScript latest tag totypescript@latest.