You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceCustomEvent<T=any>extendsEvent{/** * Returns any custom data event was created with. * Typically used for synthetic events. */readonlydetail: T;initCustomEvent(typeArg: string,canBubbleArg: boolean,cancelableArg: boolean,detailArg: T): void;}
However, emitting a primitive value for an event detail is not future-resistant. If we ever need to pass more data, we'll be forced to break backward compatibility for a large number of customers.
Solution
Rather than break backward compatibility later—after lots of downstream consumers have already wrapped the new v0.44.0 MDCList API from PR #4144—we should break it now.
Fixes#4355
BREAKING CHANGE: The default `MDCListAdapter.notifyAction()` implementation now emits an object of type `{index: number}` rather than a primitive `number` directly.
Fixes#4355
BREAKING CHANGE: The default `MDCListAdapter.notifyAction()` implementation now emits an object of type `{index: number}` rather than a primitive `number` directly.
Problem
We're currently emitting a
number
value for theCustomEvent.detail
property inMDCListAdapter.notifyAction()
:material-components-web/packages/mdc-list/index.js
Lines 279 to 281 in af950fc
This is technically allowed by TypeScript's
CustomEvent<T>
interface:https://github.com/Microsoft/TypeScript/blob/2f9218f346bbc606cccc4aebfca1c2c4f3167fee/lib/lib.dom.d.ts#L3415-L3422
However, emitting a primitive value for an event
detail
is not future-resistant. If we ever need to pass more data, we'll be forced to break backward compatibility for a large number of customers.Solution
Rather than break backward compatibility later—after lots of downstream consumers have already wrapped the new v0.44.0
MDCList
API from PR #4144—we should break it now.This will also simplify PR #4334 and PR #4342.
The text was updated successfully, but these errors were encountered: