SemVer: consider splitting SemVer into Release | Prerelease while unstable
Los mantenedores suelen responder en 1 día
@effect-bot ya está trabajando en esto.
Desde el 29/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Written by an AI agent (Antigravity) on behalf of @jasonkuhrt.
Proposal: while effect/SemVer is still @stability unstable, consider splitting SemVer into a union Release | Prerelease (analogous to DateTime = Utc | Zoned) so callers can statically require stable releases and narrow both branches of SemVer.isPrerelease.
Context
On [email protected] and main (584c9e090, introduced in #9243), SemVer is a single flat interface:
export interface SemVer extends Pipeable, Equal.Equal, Inspectable {
readonly [TypeId]: typeof TypeId
readonly major: number
readonly minor: number
readonly patch: number
readonly prerelease: ReadonlyArray<string | number>
readonly build: ReadonlyArray<string>
}
Even with isPrerelease narrowed to a type guard (proposed separately in #11048 / #11049), a flat interface leaves two gaps:
import { Array, SemVer } from "effect"
declare function publishStable(version: SemVer.Release): void
const version = SemVer.parseUnsafe("2.0.0-rc.1")
if (SemVer.isPrerelease(version)) {
Array.headNonEmpty(version.prerelease) // "rc"
publishStable(SemVer.release(version)) // SemVer.release returns Release
} else {
// With a union, `version` narrows to SemVer.Release here too;
// with a flat interface it stays SemVer.
publishStable(version)
}
Candidate shapes
Both variants keep SemVer.make({ ...version, patch: version.patch + 1 }), SemVerRange, Schema.SemVer, and array methods (.map, .filter, .reduce, .join, for...of) on version.prerelease working:
| Aspect | Variant A: structural (readonly []) |
Variant B: tagged (_tag, like DateTime) |
|---|---|---|
| Definition | Release has readonly prerelease: readonly []; Prerelease has NonEmptyReadonlyArray<string | number>; type SemVer = Release | Prerelease |
Same as A, plus readonly _tag: "Release" / readonly _tag: "Prerelease" on instances |
Two-way isPrerelease narrowing |
Yes (if -> Prerelease, else -> Release) |
Yes, plus v._tag === "Release" and Match.tag work natively |
| Operation return types | release / bumpMajor / bumpMinor / bumpPatch can return Release; bumpPre* can return Prerelease |
Same |
| Runtime footprint | Zero runtime change (including across mixed Effect versions sharing ~effect/SemVer) |
One own _tag property on instances (visible in Object.keys / spread; toJSON / inspect unchanged). If an untagged pre-4.2 SemVer crosses into isSemVer / fromInput in a dual-package setup, Variant B would either need a getter/re-tag or isSemVer to reject untagged values so Match.tagsExhaustive does not throw |
Verified trade-offs (probed against main at 584c9e090)
Both variants pass pnpm check and the 763 SemVer/SemVerRange/Schema tests once internal Core in SemVer.ts stops using Pick<SemVer, ...> and types prerelease: ReadonlyArray<string | number> directly. Three consumer breaks surface under both variants:
interface X extends SemVer.SemVerfails withTS2312because an interface cannot extend a union type alias (callers must use an intersection or composition instead).version.prerelease[0]becomesstring | number | undefinedon an un-narrowedSemVereven withoutnoUncheckedIndexedAccess(because(readonly [])[0]isundefined; onmainit isstring | number).Pick<SemVer, "prerelease">becomes{ readonly prerelease: readonly [] | NonEmptyReadonlyArray<string | number> }, rejecting plainReadonlyArray<string | number>(the same errorSemVerRange.tshit on internalCore).
Under Effect's @stability unstable policy, those breaks make a union split a minor change — which is why #11049 keeps SemVer flat and this is opened separately for maintainer input. Totally fine if Effect prefers to keep SemVer flat; if maintainers want either variant, happy to follow up with a PR once a direction is agreed.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 21 h 22 min
- PR fusionados (30 d)
- 486
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11097 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Posiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#11096 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
check:failed streams:edit
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
iptv-org/iptv#60585 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsPosiblemente ocupada @Piyush4801 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jaegertracing/jaeger-ui#4865 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día