Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/effect/src/SchemaAST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ export const Objects: new(
pending: Effect.Effect<unknown, SchemaIssue.Issue, any>
): Effect.Effect<unknown, SchemaIssue.Issue, any> => {
const property = properties![index]
return Effect.flatMap(Effect.exit(pending), (exit) => {
return Effect.flatMap(Effect.exit(pending), (exit): Effect.Effect<unknown, SchemaIssue.Issue, any> => {
// Copy the parsed prefix per execution so reruns cannot overwrite earlier results.
const state: ObjectParserState = { ...snapshot, out: { ...snapshot.out } }
const terminal = stepProperty(state, property, exit)
Expand Down
11 changes: 7 additions & 4 deletions packages/effect/src/graphql/GraphQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ const Proto = {

// The middleware type of an operation is phantom and its Schemas are erased to
// `Schema.Top` here, so the typed constructors below state their operation
// type with one assertion each.
// type with one assertion each. Each constructor also asserts to its own
// declared type: TypeScript 7.1 relates the `Variables` conditional in
// `makeOperation` to the one in the constructor's annotation structurally
// rather than by identity, and the structural check fails.
const makeProto = (fields: Omit<Any, typeof TypeId | "pipe" | "middleware">): Any =>
Object.assign(Object.create(Proto), fields)

Expand Down Expand Up @@ -323,7 +326,7 @@ export const query: <
readonly result: Result
}
) => Operation<"query", Name, Variables extends Schema.Struct.Fields ? Schema.Struct<Variables> : Variables, Result> =
makeOperation("query")
makeOperation("query") as typeof query

/**
* Defines a mutation. Same shape as {@link query}.
Expand Down Expand Up @@ -363,7 +366,7 @@ export const mutation: <
Name,
Variables extends Schema.Struct.Fields ? Schema.Struct<Variables> : Variables,
Result
> = makeOperation("mutation")
> = makeOperation("mutation") as typeof mutation

/**
* Defines a subscription. The client method for a subscription returns a
Expand Down Expand Up @@ -404,7 +407,7 @@ export const subscription: <
Name,
Variables extends Schema.Struct.Fields ? Schema.Struct<Variables> : Variables,
Result
> = makeOperation("subscription")
> = makeOperation("subscription") as typeof subscription

/**
* The `__typename` Schema for the "every other type" member of a generated
Expand Down
9 changes: 8 additions & 1 deletion packages/effect/src/http/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,19 @@ export const catchTag: {
): HttpClient.With<E1 | ExcludeTag<E, K extends NonEmptyReadonlyArray<string> ? K[number] : K>, R1 | R> =>
transformResponse(
self,
// TypeScript 7.1 does not relate the error type `Effect.catchTag` returns
// to the `ExcludeTag` declared here, because each declares its own copy
// of the conditional on `K`. The assertion restates the declared type.
(effect) =>
Effect.catchTag<HttpClientResponse.HttpClientResponse, E, R, K, R1, E1, HttpClientResponse.HttpClientResponse>(
effect,
tag,
f
)
) as Effect.Effect<
HttpClientResponse.HttpClientResponse,
E1 | ExcludeTag<E, K extends NonEmptyReadonlyArray<string> ? K[number] : K>,
R | R1
>
)
)

Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/schema/SchemaCompiler/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const makeObjectBase = (
pending: Effect.Effect<unknown, SchemaIssue.Issue, any>
): Effect.Effect<unknown, SchemaIssue.Issue, any> => {
const property = properties![index]
return Effect.flatMap(Effect.exit(pending), (exit) => {
return Effect.flatMap(Effect.exit(pending), (exit): Effect.Effect<unknown, SchemaIssue.Issue, any> => {
// Each execution gets its own output; `issues` is still undefined here
// because `errors: "all"` is routed to the fallback before suspending.
const state: ObjectParserState = { ...snapshot, out: { ...snapshot.out } }
Expand Down
5 changes: 4 additions & 1 deletion packages/platform/browser/test/fixtures/rpc-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class StreamUsers extends Rpc.make("StreamUsers", {

class CurrentUser extends Context.Service<CurrentUser, User>()("CurrentUser") {}

class Unauthorized extends Schema.Error<Unauthorized>("Unauthorized")({
// Exported so declaration emit can name it. Error classes are yieldable, so a
// private one is a cycle that TypeScript 7.1 reports as TS5088 in `rpc-e2e.ts`
// (microsoft/TypeScript#64461).
export class Unauthorized extends Schema.Error<Unauthorized>("Unauthorized")({
_tag: Schema.tag("Unauthorized")
}) {}

Expand Down
5 changes: 4 additions & 1 deletion packages/platform/node/test/fixtures/rpc-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class StreamUsers extends Rpc.make("StreamUsers", {

class CurrentUser extends Context.Service<CurrentUser, User>()("CurrentUser") {}

class Unauthorized extends Schema.Error<Unauthorized>("Unauthorized")({
// Exported so declaration emit can name it. Error classes are yieldable, so a
// private one is a cycle that TypeScript 7.1 reports as TS5088 in `rpc-e2e.ts`
// (microsoft/TypeScript#64461).
export class Unauthorized extends Schema.Error<Unauthorized>("Unauthorized")({
_tag: Schema.tag("Unauthorized")
}) {}

Expand Down
Loading