refactor(effect): upgrade opencode to beta.46 context APIs (#21977)

This commit is contained in:
Kit Langton
2026-04-10 23:06:28 -04:00
committed by GitHub
parent af8aff3788
commit 9581bf0670
75 changed files with 195 additions and 209 deletions

View File

@@ -1,6 +1,6 @@
import { AsyncLocalStorage } from "async_hooks"
export namespace Context {
export namespace LocalContext {
export class NotFound extends Error {
constructor(public override readonly name: string) {
super(`No context found for ${name}`)

View File

@@ -6,7 +6,7 @@ import { Schema } from "effect"
* @example
* export const Foo = fooSchema.pipe(
* withStatics((schema) => ({
* zero: schema.makeUnsafe(0),
* zero: schema.make(0),
* from: Schema.decodeUnknownOption(schema),
* }))
* )
@@ -26,7 +26,7 @@ type NewtypeBrand<Tag extends string> = { readonly [NewtypeBrand]: Tag }
* @example
* class QuestionID extends Newtype<QuestionID>()("QuestionID", Schema.String) {
* static make(id: string): QuestionID {
* return this.makeUnsafe(id)
* return this.make(id)
* }
* }
*
@@ -39,7 +39,7 @@ export function Newtype<Self>() {
abstract class Base {
declare readonly [NewtypeBrand]: Tag
static makeUnsafe(value: Schema.Schema.Type<S>): Self {
static make(value: Schema.Schema.Type<S>): Self {
return value as unknown as Self
}
}
@@ -47,7 +47,7 @@ export function Newtype<Self>() {
Object.setPrototypeOf(Base, schema)
return Base as unknown as (abstract new (_: never) => Branded) & {
readonly makeUnsafe: (value: Schema.Schema.Type<S>) => Self
} & Omit<Schema.Opaque<Self, S, {}>, "makeUnsafe">
readonly make: (value: Schema.Schema.Type<S>) => Self
} & Omit<Schema.Opaque<Self, S, {}>, "make">
}
}