jupyterlab-contrib / jupyterlab_toastify

Customize 'react-toastify' to integrate nicely in JupyterLab.
Other
22 stars 4 forks source link

Compilation error for csstype 3.x #12

Closed TK-21st closed 3 years ago

TK-21st commented 4 years ago

The react dependency seems to have bumped csstype to 3.x and it's breaking the compilation. image

This seems to be coming from React.ReactText, which leads to the following typescript compilation errors:

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:42:94 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

42     const error: (message: React.ReactNode, options?: IOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:51:96 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

51     const warning: (message: React.ReactNode, options?: IOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:60:93 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

60     const info: (message: React.ReactNode, options?: IOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:69:96 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

69     const success: (message: React.ReactNode, options?: IOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:78:99 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

78     const inProgress: (message: React.ReactNode, options?: IOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:108:49 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

108     const dismiss: (toastId?: import("csstype").AnimationIterationCountProperty) => Promise<false | void>;
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/jupyterlab_toastify/lib/ToastJupyterLab.d.ts:118:96 - error TS2694: Namespace '"/Users/tingkailiu/Projects/FFBO/FBLV2/NeuroMynerva/node_modules/csstype/index"' has no exported member 'AnimationIterationCountProperty'.

118     const notify: (content: ToastContent, options?: ToastOptions) => Promise<import("csstype").AnimationIterationCountProperty>;
                                                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 14 errors.
fcollonval commented 4 years ago

Hey @TK-21st, thank you for reporting. Did you open an issue on https://github.com/DefinitelyTyped/DefinitelyTyped?

React.ReactText has for definition:

    type ReactText = string | number;

Reference: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/edcfb4c488b2463411299fa8ff17f75758734291/types/react/index.d.ts#L234

So the use of a type coming from csstype is weird.

Which version of typescript are you using? Did you try by forcing @types/react to be lesser than 16.9.44 to see if it works?

fcollonval commented 3 years ago

Closing this one as stalled.