Microsoft-authentication-library-for-js: Wrong type for getAllAccounts, should be nullable

Created on 17 Nov 2020  路  2Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

Library

Description

In all examples calling getAllAccounts() there is a check for null done, see here. But the type defined is not defined as nullable (as can be seen in IPublicClientApplication interface).

Expected behavior

It would be helpful to know, through typing as well, that the result can be null, or if that is not the case, to adapt the examples to match the current behaviour.

documentation msal-browser samples

Most helpful comment

@Calamari Thanks for pointing this out, looks like the sample needs to be updated. getAllAccounts will return an empty array if no accounts are found.

@derisen Could you please update the samples to check for currentAccounts.length === 0 instead of null?

All 2 comments

@Calamari Thanks for pointing this out, looks like the sample needs to be updated. getAllAccounts will return an empty array if no accounts are found.

@derisen Could you please update the samples to check for currentAccounts.length === 0 instead of null?

Closing as the samples have been updated

Was this page helpful?
0 / 5 - 0 ratings