I am currently utilizing the Okta react library found here:
https://github.com/okta/okta-oidc-js/tree/master/packages/okta-react
. Unfortunately, this library does not include type definitions.
To address this issue, I have created a .d.ts
definition file with the following content:
declare module "@okta/okta-react"
. However, this library utilizes a higher order component in the form of: import { withAuth } from '@okta/okta-react';
(more details can be found at https://github.com/okta/okta-oidc-js/tree/master/packages/okta-react#withauth)
My question is how to properly define this in my definitions file. Is the following declaration valid?
declare module "@okta/okta-react" {
function withAuth(any): any
}
In addition, I have drafted an interface outlining the methods provided by withAuth
, such as:
interface OktaWithAuth {
/**
* Returns true or false, depending on whether the user has an active access or id token.
*/
isAuthenticated(): Promise<boolean>;
....
}
Any insights or assistance would be greatly appreciated. Thank you.