question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow keycloak-js default export to be used as a constructor

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RoiEXLabcommented, Mar 24, 2022

@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

0reactions
jonkoopscommented, Mar 25, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found