Skip to content

Commit 256ae85

Browse files
committed
cleanup
1 parent c9e0c44 commit 256ae85

19 files changed

Lines changed: 41 additions & 41 deletions

File tree

.changeset/three-hotels-roll.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"effect-app": patch
3+
"@effect-app/infra": patch
4+
"@effect-app/vue": patch
5+
---
6+
7+
cleanup

packages/effect-app/src/Context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export const accessCn = <
9393
>(
9494
Tag: Opaque<Self, Shape>,
9595
key: K
96-
): Effect.Effect<Shape[K], never, Self> => Tag.useSync((s) => s[key]) as any
96+
): Effect.Effect<Shape[K], never, Self> => Tag.useSync((s) => s[key])
9797

9898
/** Accessor for a service property that is an Effect. Delegates via `use`. */
9999
export const accessEffectCn = <

packages/effect-app/src/Effect.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import { Effect, Option, Ref } from "effect"
66
import * as Def from "effect/Deferred"
7-
import * as Fiber from "effect/Fiber"
87
import type { Scope } from "effect/Scope"
98
import type { Semaphore } from "effect/Semaphore"
109
import type * as Context from "./Context.js"
@@ -112,10 +111,6 @@ export function modifyWithPermitWithEffect<A>(ref: Ref.Ref<A>, semaphore: Semaph
112111
)
113112
}
114113

115-
export function joinAll<E, A>(fibers: Iterable<Fiber.Fiber<A, E>>): Effect.Effect<readonly A[], E> {
116-
return Fiber.joinAll(fibers) as any
117-
}
118-
119114
type ServiceA<T> = T extends Effect.Effect<infer S, any, any> ? S
120115
: T extends Context.Service<any, infer S> ? S
121116
: never

packages/effect-app/src/Schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function TaggedStruct<const Tag extends SchemaAST.LiteralValue, const Fie
6565
value: Tag,
6666
fields: Fields
6767
): S.TaggedStruct<Tag, Fields> {
68-
return Struct({ _tag: S.tag(value), ...fields }) as any
68+
return Struct({ _tag: S.tag(value), ...fields })
6969
}
7070
export type TaggedStruct<Tag extends SchemaAST.LiteralValue, Fields extends S.Struct.Fields> = S.TaggedStruct<
7171
Tag,

packages/effect-app/src/Schema/SpecialOpenApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function deduplicateOpenApiSchemas(
7070
}
7171
}
7272

73-
if (remapping.size === 0) return postProcessJsonSchema(spec) as Record<string, any>
73+
if (remapping.size === 0) return postProcessJsonSchema(spec)
7474

7575
// Build new schemas object without duplicates
7676
const newSchemas: Record<string, any> = {}
@@ -85,7 +85,7 @@ export function deduplicateOpenApiSchemas(
8585
newSpec["components"]["schemas"] = newSchemas
8686
rewriteRefs(newSpec, remapping)
8787

88-
return postProcessJsonSchema(newSpec) as Record<string, any>
88+
return postProcessJsonSchema(newSpec)
8989
}
9090

9191
/**

packages/effect-app/src/Schema/ext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const Literals = <const Literals extends NonEmptyReadonlyArray<AST.Litera
100100
withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.succeed(a)))
101101
}) // todo: copy annotations from original?
102102
},
103-
Default: literals[0] as typeof literals[0],
103+
Default: literals[0],
104104
withDefault: s.pipe(S.withConstructorDefault(Effect.succeed(literals[0]))),
105105
withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.succeed(literals[0])))
106106
})
@@ -353,7 +353,7 @@ export const provide: {
353353
return self.pipe(
354354
S.middlewareDecoding((effect) => prov(effect)),
355355
S.middlewareEncoding((effect) => prov(effect))
356-
) as ProvidedCodec<Self, R>
356+
)
357357
})
358358
export const contextFromServices = Effect.fnUntraced(function*<
359359
Self extends S.Top,

packages/effect-app/src/client/apiClientFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const getFiltered = <M extends RequestsAny>(resource: M) => {
106106

107107
export const getMeta = <M extends RequestsAny>(resource: M): { moduleName: ExtractModuleName<M> } => {
108108
const first = typedValuesOf(getFiltered(resource))[0]
109-
if (first && "moduleName" in first) return { moduleName: first.moduleName } as any
109+
if (first && "moduleName" in first) return { moduleName: first.moduleName }
110110
throw new Error("No moduleName on requests!")
111111
}
112112

@@ -261,7 +261,7 @@ const makeApiClientFactory = Effect
261261
const m = yield* makeClientFor(models, requestLevelLayers, options)
262262
cache.set(models, m.client)
263263
register.push(m.mr)
264-
return m.client as Client<M, ExtractModuleName<M>>
264+
return m.client
265265
})
266266
}
267267

packages/effect-app/src/client/errors.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class NotFoundError<ItemType = string> extends TaggedErrorClass<NotFoundE
2929
props: { type: string; id: unknown; cause?: unknown },
3030
disableValidation?: boolean
3131
) {
32-
super(props as any, disableValidation as any)
32+
super(props, disableValidation as any)
3333
}
3434
override get message() {
3535
return `Didn't find ${(this as any).type}#${JSON.stringify((this as any).id)}`
@@ -47,7 +47,7 @@ export class InvalidStateError extends TaggedErrorClass<InvalidStateError>()("In
4747
}) {
4848
constructor(messageOrObject: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
4949
super(
50-
typeof messageOrObject === "object" ? messageOrObject : { message: messageOrObject } as any,
50+
typeof messageOrObject === "object" ? messageOrObject : { message: messageOrObject },
5151
disableValidation as any
5252
)
5353
}
@@ -61,7 +61,7 @@ export class ServiceUnavailableError extends TaggedErrorClass<ServiceUnavailable
6161
}) {
6262
constructor(messageOrObject: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
6363
super(
64-
typeof messageOrObject === "object" ? messageOrObject : { message: messageOrObject } as any,
64+
typeof messageOrObject === "object" ? messageOrObject : { message: messageOrObject },
6565
disableValidation as any
6666
)
6767
}
@@ -77,7 +77,7 @@ export class ValidationError extends TaggedErrorClass<ValidationError>()("Valida
7777
props: { errors: ReadonlyArray<unknown>; cause?: unknown },
7878
disableValidation?: boolean
7979
) {
80-
super(props as any, disableValidation as any)
80+
super(props, disableValidation as any)
8181
}
8282
override get message() {
8383
return `Validation failed: ${(this as any).errors.map((e: any) => JSON.stringify(e, undefined, 2)).join(",\n")}`
@@ -91,7 +91,7 @@ export class NotLoggedInError extends TaggedErrorClass<NotLoggedInError>()("NotL
9191
message: S.String
9292
}) {
9393
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
94-
super(messageFallback(messageOrObject) as any, disableValidation as any)
94+
super(messageFallback(messageOrObject), disableValidation as any)
9595
}
9696
override toString() {
9797
return `NotLoggedInError: ${this.message}`
@@ -105,7 +105,7 @@ export class LoginError extends TaggedErrorClass<LoginError>()("NotLoggedInError
105105
message: S.String
106106
}) {
107107
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
108-
super(messageFallback(messageOrObject) as any, disableValidation as any)
108+
super(messageFallback(messageOrObject), disableValidation as any)
109109
}
110110
override toString() {
111111
return `LoginError: ${this.message}`
@@ -116,7 +116,7 @@ export class UnauthorizedError extends TaggedErrorClass<UnauthorizedError>()("Un
116116
message: S.String
117117
}) {
118118
constructor(messageOrObject?: string | { message: string; cause?: unknown }, disableValidation?: boolean) {
119-
super(messageFallback(messageOrObject) as any, disableValidation as any)
119+
super(messageFallback(messageOrObject), disableValidation as any)
120120
}
121121
override toString() {
122122
return `UnauthorizedError: ${this.message}`
@@ -144,7 +144,7 @@ export class OptimisticConcurrencyException extends TaggedErrorClass<OptimisticC
144144
disableValidation?: boolean
145145
) {
146146
super(
147-
"message" in args ? args : { message: `Existing ${args.type} ${args.id} record changed` } as any,
147+
"message" in args ? args : { message: `Existing ${args.type} ${args.id} record changed` },
148148
disableValidation as any
149149
)
150150
if (!("message" in args)) {

packages/effect-app/src/utils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,7 @@ function decorateNew(
313313
if (out.descriptor) {
314314
out.descriptor = Object.assign({}, out.descriptor)
315315
}
316-
const actualDesc: PropertyDescriptor = <any> (
317-
out.descriptor || /* istanbul ignore next */ out
318-
)
316+
const actualDesc: PropertyDescriptor = out.descriptor || /* istanbul ignore next */ out
319317

320318
const originalMethod = validateAndExtractMethodFromDescriptor(actualDesc)
321319
const isStatic = inp.placement === "static"
@@ -684,7 +682,7 @@ export type OptPromise<T extends () => any> = (
684682
) => Promise<ReturnType<T>> | ReturnType<T>
685683

686684
export function access<T extends string, T2>(t: Record<T, T2>) {
687-
return (key: T) => t[key] as T2
685+
return (key: T) => t[key]
688686
}
689687

690688
export function todayAtUTCNoon() {

packages/infra/src/QueueMaker/memQueue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { MemQueue } from "../adapters/memQueue.js"
66
import { getRequestContext, setupRequestContextWithCustomSpan } from "../api/setupRequest.js"
77
import { InfraLogger } from "../logger.js"
88
import { reportNonInterruptedFailure, reportNonInterruptedFailureCause } from "./errors.js"
9-
import { type QueueBase, QueueMeta } from "./service.js"
9+
import { QueueMeta } from "./service.js"
1010

1111
export const makeMemQueue = Effect.fnUntraced(function*<
1212
Evt extends { id: S.StringId; _tag: string },
@@ -105,5 +105,5 @@ export const makeMemQueue = Effect.fnUntraced(function*<
105105
}, (effect) => effect.pipe(silenceAndReportError, Effect.forever))()
106106
}
107107
}
108-
return queue as QueueBase<Evt, DrainEvt>
108+
return queue
109109
})

0 commit comments

Comments
 (0)