Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error. react-transition-group/Transition #5271

Closed
DrNixx opened this issue Jul 7, 2020 · 8 comments
Closed

Compilation error. react-transition-group/Transition #5271

DrNixx opened this issue Jul 7, 2020 · 8 comments

Comments

@DrNixx
Copy link

DrNixx commented Jul 7, 2020

Describe the bug

I have compilation error after update to 1.1.0.

To Reproduce

  1. After update to 1.1.0
    node_modules/react-bootstrap/esm/Fade.d.ts:2:45 - error TS7016: Could not find a declaration file for module 'react-transition-group/Transition'. 'D:/Workspace/JavaScript/onix/onix-chess-ctrls/node_modules/react-transition-group/cjs/Transition.js' implicitly has an 'any' type. 2 import Transition, { TransitionProps } from 'react-transition-group/Transition';

  2. Install types definitions @types/react-transition-group
    node_modules/react-bootstrap/esm/Fade.d.ts:10:108 - error TS2314: Generic type 'Transition<RefElement>' requires 1 type argument(s). 10 declare const Fade: React.ForwardRefExoticComponent<Pick<FadeProps, React.ReactText> & React.RefAttributes<Transition>>;

@mxsxs2
Copy link

mxsxs2 commented Jul 7, 2020

If you are really stuck, then you can add "skipLibCheck": true to your tsconfig.json as a work around until they fix it.
As the documentation says:

Skip type checking of all declaration files (*.d.ts).

@jquense jquense closed this as completed in 8e30fb8 Jul 7, 2020
@DrNixx
Copy link
Author

DrNixx commented Jul 8, 2020

The problem has not disappeared and the problem is that react-bootstrap has the dependency to "@types/react-transition-group": "^ 4.2.4", but the latest version 4.4.0 is installed during react-bootstrap installation or upgrading.
Version 4.4.0 is not compatible with react-bootstrap 1.1.1.

If manually downgrade the version to 4.2.4, then compilation is complete normal.

You need to either fix the package version with strong version rule
"@types/react-transition-group": "4.2.4"
or bring the Transition call in accordance with 4.4.0

@kyletsang
Copy link
Member

@DrNixx what's the exact error you are getting?

@DrNixx
Copy link
Author

DrNixx commented Jul 8, 2020

@DrNixx what's the exact error you are getting?

node_modules/react-bootstrap/esm/Fade.d.ts:10:108 - error TS2314: Generic type 'Transition' requires 1 type argument(s).
10 declare const Fade: React.ForwardRefExoticComponent<Pick<FadeProps, React.ReactText> & React.RefAttributes>;

Declaration is:
In Transition.d.ts 4.2.4
declare class Transition extends Component<TransitionProps> {}
In Transition.d.ts 4.4.0
declare class Transition<RefElement extends HTMLElement | undefined> extends Component<TransitionProps<RefElement>> {}

@DrNixx
Copy link
Author

DrNixx commented Jul 8, 2020

If upgrade package to @types/react-transition-group@4.4.0 in react-bootstrap compilation will also fail

You need pin version @types/react-transition-group to 4.2.4 (without ^)
or upgrade version to 4.4.0 and change Fade declaration:
const Fade = React.forwardRef<Transition<any>, FadeProps>(

@mxsxs2
Copy link

mxsxs2 commented Jul 8, 2020

Version 1.1.1 does not fix the second issue:

node_modules/react-bootstrap/esm/Fade.d.ts:10:108 - error TS2314: Generic type 'Transition<RefElement>' requires 1 type argument(s).

10 declare const Fade: React.ForwardRefExoticComponent<Pick<FadeProps, React.ReactText> & React.RefAttributes<Transition>>;
                                                                                                              ~~~~~~~~~~

node_modules/react-bootstrap/esm/Overlay.d.ts:98:125 - error TS2314: Generic type 'Transition<RefElement>' requires 1 type argument(s).

98         transition: React.ForwardRefExoticComponent<Pick<import("./Fade").FadeProps, React.ReactText> & React.RefAttributes<import("react-transition-group/Transition").default>>;

After installation the package-lock.json has these:

"react-bootstrap": {
            "version": "1.1.1",
            "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-1.1.1.tgz",
            "integrity": "sha512-DsJ1aaXQPa3ob/Bh2JXnbWmZJHNxS18HbiJdyBhumf6OHk6rVXo329uwa2lHI0ZuxPO3mA8OJLOT0lighV/e8Q==",
            "requires": {
                "@babel/runtime": "^7.4.2",
                "@restart/context": "^2.1.4",
                "@restart/hooks": "^0.3.21",
                "@types/classnames": "^2.2.10",
                "@types/invariant": "^2.2.33",
                "@types/prop-types": "^15.7.3",
                "@types/react": "^16.9.35",
                "@types/react-transition-group": "^4.2.4",
                "@types/warning": "^3.0.0",
                "classnames": "^2.2.6",
                "dom-helpers": "^5.1.2",
                "invariant": "^2.2.4",
                "prop-types": "^15.7.2",
                "prop-types-extra": "^1.1.0",
                "react-overlays": "^3.2.0",
                "react-transition-group": "^4.0.0",
                "uncontrollable": "^7.0.0",
                "warning": "^4.0.3"
            }
        },

"@types/react-transition-group": {
            "version": "4.4.0",
            "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz",
            "integrity": "sha512-/QfLHGpu+2fQOqQaXh8MG9q03bFENooTb/it4jr5kKaZlDQfWvjqWZg48AwzPVMBHlRuTRAY7hRHCEOXz5kV6w==",
            "requires": {
                "@types/react": "*"
            }
        },
 "react-transition-group": {
            "version": "4.4.1",
            "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.1.tgz",
            "integrity": "sha512-Djqr7OQ2aPUiYurhPalTrVy9ddmFCCzwhqQmtN+J3+3DzLO209Fdr70QrN8Z3DsglWql6iY1lDWAfpFiBtuKGw==",
            "requires": {
                "@babel/runtime": "^7.5.5",
                "dom-helpers": "^5.0.1",
                "loose-envify": "^1.4.0",
                "prop-types": "^15.6.2"
            }
        },

@jquense
Copy link
Member

jquense commented Jul 8, 2020

This is a problem then with the RTG types being out of date on DT?

@nicolascbarbosa
Copy link

nicolascbarbosa commented Jul 9, 2020

I also had the same problem here, I fixed it by adding version @types/react-transition-group": "4.2.4" in my package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants