mauriciovigolo / keycloak-angular

Easy Keycloak setup for Angular applications.
MIT License
730 stars 280 forks source link

Use import of keycloak instead of namespace #595

Closed HerrDerb closed 2 days ago

HerrDerb commented 6 days ago

When using both current versions

    "keycloak-angular": "16.1.0",
    "keycloak-js": "26.0.5",

building the project causes quite a few of those:

X [ERROR] TS2503: Cannot find namespace 'Keycloak'. [plugin angular-compiler]

    node_modules/keycloak-angular/lib/core/interfaces/keycloak-options.d.ts:12:22:
      12 │     config?: string | Keycloak.KeycloakConfig;

Originally posted by @HerrDerb in https://github.com/mauriciovigolo/keycloak-angular/issues/583#issuecomment-2490961630

This is reproduceable by using "moduleResolution:" "node"

It seems that angular-keycloak relies on the exported Keycloak namespace which is marked deprecated.

Instead of using the namespace Keycloak angular-keycloak library should use the export default Keycloak

See -> https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-js/lib/keycloak.d.ts#L655

LukasMachetanz commented 2 days ago

I don't know if this is for sure connected to your problem, but it seems that using version 26 requires to use "moduleResolution": "Bundler" as mentioned in the official upgrading guide.

HerrDerb commented 2 days ago

Point made