Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type Definition file for Keycloak.js

I'm using Keycloak auth mechanism for my angular/node/typescript application .I could not find a definitelyTyped d.ts file for Keycloak.js

Is there a typescript equivalent/work in progress for this JBOSS Keycloak.js adapter or do I have to write one ? any inputs/pointers would be much appreciated

like image 621
sivaD Avatar asked Dec 23 '15 06:12

sivaD


2 Answers

There is an official type definition at:

https://github.com/keycloak/keycloak/blob/master/adapters/oidc/js/src/main/resources/keycloak.d.ts

and here

https://www.npmjs.com/package/@types/keycloak-js

https://www.npmjs.com/package/keycloak-js

From @types/keycloak-js:

keycloak-js provides its own type definitions, so you don't need @types/keycloak-js installed!

like image 124
Mario Eis Avatar answered Oct 23 '22 00:10

Mario Eis


A simple one keycloak.d.ts can be written with the contents:

declare var keycloak:any;
declare module "keycloak" {
    export = keycloak;
}

More : https://basarat.gitbooks.io/typescript/content/docs/types/migrating.html

like image 7
basarat Avatar answered Oct 23 '22 01:10

basarat