microsoft-authentication-library-for-js icon indicating copy to clipboard operation
microsoft-authentication-library-for-js copied to clipboard

Better types for EventMessage

Open vezaynk opened this issue 1 year ago • 3 comments

Improving typings via union types that correlate between events and payloads.

Based on https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/events.md

That doc seems somewhat outdated

  • Missing POPUP_OPENED payload type. Im guessing its PopupEvent?
  • Remove ACTIVE_ACCOUNT_CHANGED, INITIALIZE_START, INITIALIZE_END

This allows for TypeScript to refine types based on the eventType property, and match the correct payload type automatically.

Please review to make sure I got it right.

vezaynk avatar Jul 17 '24 20:07 vezaynk

@microsoft-github-policy-service agree company="Penn Interactive Ventures, LLC"

vezaynk avatar Jul 18 '24 20:07 vezaynk

@tnorling Could I have some 👀 on this?

vezaynk avatar Jul 29 '24 20:07 vezaynk

Thanks for the suggestion, unfortunately the proposed changes aren't compatible anymore with some changes we've made since and to do this right may require some breaking changes. I'm going to close this but I agree this is a nice to have, I've opened an item on our internal backlog to see what we can do here to make this better in the future.

tnorling avatar May 16 '25 18:05 tnorling