AxaFrance / oidc-client

Light, Secure, Pure Javascript OIDC (Open ID Connect) Client. We provide also a REACT wrapper (compatible NextJS, etc.).
MIT License
597 stars 160 forks source link

Typescript error 6.20.1: OidcProvider Property 'fetch' is missing in type #1075

Closed rasa2k closed 1 year ago

rasa2k commented 1 year ago

Hi,

I'm getting this error on latest version. Using React and Typescript. Shouldn't the property 'fetch' be optional? I can't find any documentation on this 'fetch' props in any of your examples.

Property 'fetch' is missing in type '{ children: Element; configuration: { client_id: string; authority: string; redirect_uri: string; silent_redirect_uri: string; scope: string; service_worker_relative_url: string; service_worker_only: boolean; }; loadingComponent: () => Element; authenticatingErrorComponent: () => Element; authenticatingComponent: ()...' but required in type 'OidcProviderProps'.ts(2741)

guillaume-chervet commented 1 year ago

Hi just publish a fix @rasa2k , very sorry for the problem !

checkou the version 6.22.7

dlaraf commented 1 year ago

I'm still having the same issue after update the package to 6.22.7:

{
  "name": "@axa-fr/react-oidc",
  "version": "6.22.7",
  "private": false,
  "main": "dist/index.js",
  "jsnext:main": "dist/index.js",
  "types": "dist/index.d.ts",
  "description": "OpenID Connect & OAuth authentication using react",
  "repository": {
    "type": "git",
    "url": "https://github.com/AxaGuilDEv/react-oidc.git"
  },

I don't see any change in the commit referring the issue file OidcProvider.d.ts.


Property 'fetch' is missing in type '{ children: Element; configuration: { client_id: string; redirect_uri: string; scope: string; authority: string; service_worker_relative_url: string; service_worker_only: boolean; }; }' but required in type 'OidcProviderProps'.ts(2741)
OidcProvider.d.ts(24, 5): 'fetch' is declared here.

export declare type OidcProviderProps = {
    callbackSuccessComponent?: ComponentType<any>;
    sessionLostComponent?: ComponentType<any>;
    authenticatingComponent?: ComponentType<any>;
    authenticatingErrorComponent?: ComponentType<any>;
    loadingComponent?: ComponentType<any>;
    serviceWorkerNotSupportedComponent?: ComponentType<any>;
    configurationName?: string;
    configuration?: OidcConfiguration;
    children: any;
    onSessionLost?: () => void;
    onLogoutFromAnotherTab?: () => void;
    onLogoutFromSameTab?: () => void;
    withCustomHistory?: () => CustomHistory;
    onEvent?: (configuration: string, name: string, data: any) => void;
    fetch: Fetch;
};

should be?... fetch?: Fetch;

guillaume-chervet commented 1 year ago

Oh very sorry @dlaraf , i fix it and test in 2 hours.

rasa2k commented 1 year ago

Thanks for quick response. It's still not fixed in v.6.22.9 :/

guillaume-chervet commented 1 year ago

hi @dlaraf , All demos works with lastest excet the nextjs one. Are you using nextJS?

rasa2k commented 1 year ago

No I'm using React v.18.2.0

NicerDicerPro commented 1 year ago

Im having the same issue. Im on react 18.2.0 too:

TS2741: Property 'getFetch' is missing in type '{ children: Element; configuration: OidcConfiguration; }' but required in type 'OidcProviderProps'.
    91 |       <ApplicationCanvas />
    92 |     ) : (
  > 93 |       <OidcProvider configuration={configuration}>
guillaume-chervet commented 1 year ago

Oh, i just understood, i fix it rigth now thank you @dlaraf

NicerDicerPro commented 1 year ago

6.22.16 fixed this problem for me: https://github.com/AxaFrance/react-oidc/releases/tag/v6.22.16

guillaume-chervet commented 1 year ago

Hi @NicerDicerPro , thank you very much for the feedback. Very sorry for the issue.

NicerDicerPro commented 1 year ago

@guillaume-chervet we thank you for the quick response and fix of the problem. Keep up the good work!

rasa2k commented 1 year ago

6.22.16 fixed this problem for me too. Thanks! Have a great weekend!