'details.features.has is not a function

I am using angular 13 and es2021(also tried es6 to add 2018)

tsconfig.lib.json

...
"lib": ["dom", "es2021"]
...

I have following object.

export interface UserDetails {
  ...
  features?: Set<UserFeature>;
  ...
}

I am trying to check some values as below:

this.sessionQuery.details$.subscribe((details: UserDetails) => {
      const enableFF = details.features && (details.features as Set<UserFeature>).has({ feature: 'enableFF ', enabled: true });
 ...
    });

there is no issue on IDE but i have following issue at browser:

core.mjs:6495 ERROR TypeError: details.features.has is not a function



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source