Skip to content

Commit 15ab7f9

Browse files
Igor Savinclaude
andcommitted
types(core): use removal-marker literal for messageTypeField error message
Per PR review: `messageTypeField?: never` produces a generic "Type 'string' is not assignable to type 'never'" diagnostic. Switch to a removal-marker string literal so the diagnostic surfaces the migration hint right at the offending call site, e.g. "Type 'type' is not assignable to type '__REMOVED_USE_messageTypeResolver_INSTEAD__ | undefined'". Note on the `messageTypeField: undefined` loophole: closing it would require enabling `exactOptionalPropertyTypes` package-wide, which produces ~13 unrelated type errors in core (HandlerContainer, MessageSchemaContainer, AbstractQueueService, startupResourcePolling) and is a separate refactor. Passing `undefined` is operationally identical to omitting the field, so this guard catches the realistic regression — `messageTypeField: '<name>'`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e8358a7 commit 15ab7f9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/core/lib/types/queueOptionsTypes.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,17 @@ export type CommonQueueOptions = {
118118
* @deprecated Removed in core 25.x. Use `messageTypeResolver: { messageTypePath: '<field>' }`
119119
* (or `{ literal: '<type>' }` / `{ resolver: fn }`) instead. See UPGRADING.md.
120120
*
121-
* Typed as `never` so callers that still pass it get a compile-time error rather than
122-
* a silent runtime drop. Notably, leaving this set on a publisher with payload offloading
123-
* causes the message `type` field to be stripped from the offloaded SNS body, which then
124-
* silently fails any downstream subscription whose FilterPolicy filters on `type`.
121+
* Typed as a removal-marker string literal so callers passing the legacy option get a
122+
* compile-time error whose diagnostic shows the migration hint, rather than a silent
123+
* runtime drop. Leaving this set on a publisher with payload offloading causes the
124+
* message `type` field to be stripped from the offloaded SNS body, which then silently
125+
* fails any downstream subscription whose FilterPolicy filters on `type`.
126+
*
127+
* Note: passing `messageTypeField: undefined` still type-checks (without
128+
* `exactOptionalPropertyTypes`), but `undefined` is operationally identical to omitting
129+
* the field, so this guard catches the realistic regression (`messageTypeField: '<name>'`).
125130
*/
126-
messageTypeField?: never
131+
messageTypeField?: '__REMOVED_USE_messageTypeResolver_INSTEAD__'
127132
messageIdField?: string
128133
messageTimestampField?: string
129134
messageDeduplicationIdField?: string

0 commit comments

Comments
 (0)