thebergamo / react-native-fbsdk-next

MIT License
633 stars 165 forks source link

yarn example:devcopy fails #469

Closed built-by-as closed 4 months ago

built-by-as commented 6 months ago

🐛 Bug Report

Cannot run the example, yarn example:devcopy fails

To Reproduce

  1. clone fork of repo
  2. run yarn example:clean
  3. run yarn example:install
  4. run yarn example:devcopy

Error:

$ bob build && npm run clean:plugin && npm run build:plugin
ℹ Building target commonjs
ℹ Cleaning up previous build at lib/commonjs
ℹ Compiling 28 files in src with babel
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
✔ Wrote files to lib/commonjs
ℹ Building target module
ℹ Cleaning up previous build at lib/module
ℹ Compiling 28 files in src with babel
✔ Wrote files to lib/module
ℹ Building target typescript
ℹ Cleaning up previous build at lib/typescript
ℹ Generating type definitions with tsc
src/FBLoginButton.tsx:126:8 - error TS2786: 'RCTFBLoginButton' cannot be used as a JSX component.
  Its instance type 'Component<never, {}, any> & Readonly<NativeMethods>' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'import("/Users/amritsubramanian/code/react-native-fbsdk-next/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
        Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
          Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

126       <RCTFBLoginButton
           ~~~~~~~~~~~~~~~~

  RNFBSDKExample/node_modules/@types/react/ts5.0/index.d.ts:175:9
    175         children: ReactNode;
                ~~~~~~~~
    'children' is declared here.

src/FBLoginButton.tsx:128:9 - error TS2322: Type '(event: Event) => void' is not assignable to type 'never'.

128         onChange={this._eventHandler.bind(this)}
            ~~~~~~~~

src/FBSendButton.tsx:43:13 - error TS2322: Type '{ shareContent: ShareContent; style?: ViewStyle | undefined; }' is not assignable to type 'never'.

43     return <RCTFBSendButton {...this.props} />;
               ~~~~~~~~~~~~~~~

src/FBSendButton.tsx:43:13 - error TS2786: 'RCTFBSendButton' cannot be used as a JSX component.
  Its instance type 'Component<never, {}, any> & Readonly<NativeMethods>' is not a valid JSX element.

43     return <RCTFBSendButton {...this.props} />;
               ~~~~~~~~~~~~~~~

src/FBShareButton.tsx:43:13 - error TS2322: Type '{ shareContent: ShareContent; style?: ViewStyle | undefined; }' is not assignable to type 'never'.

43     return <RCTFBShareButton {...this.props} />;
               ~~~~~~~~~~~~~~~~

src/FBShareButton.tsx:43:13 - error TS2786: 'RCTFBShareButton' cannot be used as a JSX component.
  Its instance type 'Component<never, {}, any> & Readonly<NativeMethods>' is not a valid JSX element.

43     return <RCTFBShareButton {...this.props} />;
               ~~~~~~~~~~~~~~~~

Found 6 errors in 3 files.

Errors  Files
     2  src/FBLoginButton.tsx:126
     2  src/FBSendButton.tsx:43
     2  src/FBShareButton.tsx:43
✖ Failed to build definition files.
bob build

build files for publishing

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]

Error: Failed to build definition files.
    at build (/Users/amritsubramanian/code/react-native-fbsdk-next/node_modules/react-native-builder-bob/lib/targets/typescript.js:112:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.handler (/Users/amritsubramanian/code/react-native-fbsdk-next/node_modules/react-native-builder-bob/lib/index.js:379:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Expected Behavior

yarn example:devcopy completes without errors

Code Example

Environment

mikehardy commented 6 months ago

🤔 didn't happen when I committed previously and CI didn't catch it. I wonder if we're not committing a yarn.lock in here, allowing one of the deps to slip forward to some incompatible version, or we are using a lock but the version ranges or loose - same hypothesis though, time passed and a dep moved forward resulting in incompatible types somehow

Unexpected even if that hypothesis is wrong though. Not sure I'll have time to look at this for a little while though - my stack of open source repos where I contributes has a couple others that are farther ahead in line for maintenance than this one.

Ideally you can work through whatever type incompatibilities have happened until the bob build task works

stale[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.