AzureAD / microsoft-authentication-library-for-js

Microsoft Authentication Library (MSAL) for JS
http://aka.ms/aadv2
MIT License
3.64k stars 2.65k forks source link

Typescript definitions of IPublicClientApplication.getActiveAccount and IPublicClientApplication.logout do not match #3111

Closed elliott-with-the-longest-name-on-github closed 3 years ago

elliott-with-the-longest-name-on-github commented 3 years ago

Library

Framework

Description

Error Message

Type 'AccountInfo | null' is not assignable to type 'AccountInfo | undefined'. Type 'null' is not assignable to type 'AccountInfo | undefined'.ts(2322)

MSAL Configuration

Not providing this, as it has no bearing on the bug!

Reproduction steps

This is a super simple issue. The definition of IPublicClientApplication.logout has its account key defined as AccountInfo | undefined, while the return type of IPublicClientApplication.getActiveAccount is AccountInfo | null. It seems like these two signatures should match, so that you can do the following:

() => instance.logout({ account: instance.getActiveAccount() });

Instead of having to do this:

() => instance.logout({ account: instance.getActiveAccount() ?? undefined });

Obviously not a game-breaker, but seems like a pretty simple QOL change.

Expected behavior

Identity Provider

Browsers/Environment

Regression

Security

Source

pkanher617 commented 3 years ago

@tcc-sejohnson Thanks for opening this! This is definitely something we can take a look at. I will try to push a fix for this shortly.

elliott-with-the-longest-name-on-github commented 3 years ago

@pkanher617 Awesome! There are a few of these I've noticed. I'll see if I can catalogue them as I come upon them.