benbaran / adal-angular4

Angular 4/5/6/7 ADAL Wrapper
MIT License
86 stars 104 forks source link

Change to AuthenticationContext breaks other packages that depend on angular-adal #122

Open MobesE46 opened 5 years ago

MobesE46 commented 5 years ago

I'm trying to implement both angular-adal4 and azure-maps-control, both of which depend on angular-adal. I had angular-adal4 implemented and working fine, but when I tried to start using azure-maps-control package, it started throwing compile errors:

"Cannot use namespace 'AuthenticationContext' as a type."

These errors are on line 3189 and 3203 of \node_modules\azure-maps-control\typings\index.d.ts

authContext?: AuthenticationContext;

setAadProperties?(clientId: string, aadAppId: string, aadTenant: string, aadInstance?: string, authContext?: AuthenticationContext): void;

I think what's causing the problem in angular-adal4 is this from adal-angular.d.ts.

// Typings needed for using ADAL with Angular 4
declare module 'adal-angular' {
    export function inject(config: adal.Config): adal.AuthenticationContext;

    export class adal{

    }
}

I think this is redefining the adal-angular AuthenticationContext to be a namespace instead of a class. The azure-map-control typings file is importing adal-angular like this:

import * as AuthenticationContext from "adal-angular";

If I go an manually update their typing file to AuthenticationContext.adal, it's happy and all works fine. But that obviously isn't a solution. I tried to see if I could fork their code, but it's not on github. The only option I see is to either modify how adal-angular4 works, or use a different adal-angular wrapper.

bpanhale commented 4 years ago

I am facing same issue, Did you find any solution on this issue?