Allow keycloak-js default export to be used as a constructor
See original GitHub issueDescribe the bug
Imagine the following code:
import Keycloak from 'keycloak-js';
const keycloak = new Keycloak();
Using JavaScript (without TypeScript) this code works absolutely fine, but with TypeScript it doesn’t “compile”
Version
Latest
Expected behavior
Due to the nature of the underlying plain JavaScript I would expect both notations with and without new
keyword to work.
Actual behavior
Using the new
keyword doesn’t work in TypeScript
How to Reproduce?
No response
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Securing Applications and Services Guide - Keycloak
The confidential port used by the Keycloak server for secure connections over SSL/TLS. The default value is 8443. use-resource-role-mappings.
Read more >webpack imported module is not a constructor - Stack Overflow
The first example without curly braces is called the "default export" where the entire exported library is available through the Foo variable ( ......
Read more >How to export default constructors ? - GeeksforGeeks
The export statement is used to bind one JavaScript module to others. In order to export the default constructor, we use an export...
Read more >nestjs-keycloak-admin - npm
Start using nestjs-keycloak-admin in your project by running `npm i ... export class AppController { constructor(private readonly keycloak: ...
Read more >Keycloak Reference Guide
Enable Google, GitHub, Facebook, Twitter social login with no code required. ... You will often use Client for every Application secured by Keycloak....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@damnedOperator You can cast the type with typescript tooling to match your requirements. That’s what I did for now. It looks a little bit ugly but works no problem
Yeah that would be the best approach for now. Unfortunately releases of Keycloak JS are tied to the release process of Keycloak itself so we cannot simply publish a new version of the JS adapter.