Closed yohanb closed 4 years ago
Describe the bug
When using TypeScript, extending the class Client throws on runtime the error:
Client
TypeError: Class extends value undefined is not a constructor or null
Seems to be related to a circular dependency issue when searching for similar issues.
To Reproduce Create extendedClient.ts with the following content:
extendedClient.ts
import { Client, ClientMetadata } from "openid-client"; class ExtendedClient extends Client { constructor(metadata: ClientMetadata) { super(metadata); } } export default ExtendedClient;
Steps to reproduce the behaviour:
tsc extendedClient.ts
node extendedClient.js
Expected behaviour Being able to extend the client to provide custom functionality. For example, setting default metadata for a specific kind of flow:
class MsoDeviceCodeClient extends Client { constructor(metadata: ClientMetadata) { Object.assign(metadata, { response_types: ["code"], token_endpoint_auth_method: "none" }); super(metadata); } }
Environment:
Additional context N/A
This is not how you get to the Client constructor, the types are incorrectly exporting the type like so. It’s present on an Issuer instance as a property. Please check the docs.
Describe the bug
When using TypeScript, extending the class
Client
throws on runtime the error:Seems to be related to a circular dependency issue when searching for similar issues.
To Reproduce Create
extendedClient.ts
with the following content:Steps to reproduce the behaviour:
tsc extendedClient.ts
node extendedClient.js
Expected behaviour Being able to extend the client to provide custom functionality. For example, setting default metadata for a specific kind of flow:
Environment:
Additional context N/A