Unable to use GoogleLogin named export in TS project
See original GitHub issueAlthough the default export works fine, I get a TS error TS2305: Module '"path/to/node_modules/react-google-login/index"' has no exported member 'GoogleLogin'
when I try to use the GoogleLogin
named export from the latest release (3.0.2).
import { GoogleLogin } from 'react-google-login';
From what I’ve seen, and if I understand the TS docs, I believe the change made in PR #107 to wrap members in a namespace isn’t necessary.
To reiterate why you shouldn’t try to namespace your module contents, the general idea of namespacing is to provide logical grouping of constructs and to prevent name collisions. Because the module file itself is already a logical grouping, and its top-level name is defined by the code that imports it, it’s unnecessary to use an additional module layer for exported objects.
I was able to resolve the error by removing the namespace wrapper, allowing both the GoogleLogin
class to be exported and a default export to be defined. Would you be open to reviewing a PR?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top GitHub Comments
@yershalom @corydeppen
Please try react-google-login@3.0.3
@anthonyjgrove Yep, that should work. Thanks.