Skip to content

fix: TS diagnostic in events middleware and TextField prop binding order#52

Open
enricopolanski wants to merge 1 commit into
effect-app:mainfrom
enricopolanski:fix/compilation-issues
Open

fix: TS diagnostic in events middleware and TextField prop binding order#52
enricopolanski wants to merge 1 commit into
effect-app:mainfrom
enricopolanski:fix/compilation-issues

Conversation

@enricopolanski
Copy link
Copy Markdown
Contributor

What

Two small fixes found while getting the boilerplate to compile cleanly.

api/src/lib/middleware/events.tsmakeEvents is meant to return the SSE Effect<HttpServerResponse> so callers yield* it in their own gen (see router.ts, where handleEvents.pipe(Effect.tapCause(...)) needs an Effect). The effect/returnEffectInGen diagnostic flags this intentional pattern; suppressing it keeps return makeSSE(...) and fixes the TS2345 at router.ts:74 (a bare HttpServerResponse was being piped through Effect.tapCause).

frontend/components/TextField.vue — move v-bind="$props" before the explicit :type binding so the computed number/text type wins instead of being overridden by an incoming $props.type.

No changeset included — the repo has no .changeset/ setup; happy to add one if preferred.

- events middleware: suppress effect/returnEffectInGen so makeEvents
  returns the SSE Effect (callers yield* it). Removing the diagnostic
  fixes the TS2345 at router.ts where handleEvents.pipe(Effect.tapCause)
  required an Effect, not a bare HttpServerResponse.
- TextField.vue: bind v-bind="$props" before :type so the computed
  number/text type is not overridden by an incoming $props.type.
<v-text-field
:type="field.type === 'float' || field.type === 'int' ? 'number' : 'text'"
v-bind="$props"
:type="field.type === 'float' || field.type === 'int' ? 'number' : 'text'"
Copy link
Copy Markdown
Member

@patroza patroza Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that the original is the correct one; the default should be set by us and optional props should override it when set. However the types of the props are wrong; they don’t show up as optional but always set to X | undefined, I reckon, hence the warning.

The better workaround short of fixing the actual issue in the original typings or vue-tsc or whichever is the culprit, is to manually merge the properties on the v bind level: { …$props, type: $props.type ?? field.type === …

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought $props was there only to allow passing vuetify's own props.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants