segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
354 stars 182 forks source link

Typescript compiler errors in SDK (2.15.0) #861

Closed sushilr closed 10 months ago

sushilr commented 11 months ago

I'm migrating from 1.5.3 to 2.15.0 and running into this error:

node_modules/@segment/analytics-react-native/lib/typescript/src/analytics.d.ts(70,33): error TS2307: Cannot find module 'packages/sovran/lib/typescript/src' or its corresponding type declarations.
node_modules/@segment/analytics-react-native/lib/typescript/src/types.d.ts(2,27): error TS2307: Cannot find module '@segment/tsub/dist/store' or its corresponding type declarations.

I've followed the migration guide and instructions, attached relevant plugins etc. I also see track/screen/identify in local dev logs.

Can you help me understand if i'm doing anything wrong?

Steps to reproduce Follow the steps in the migration guide

Expected behavior Compiles successfully

SophieJung7 commented 11 months ago

I have the same error..

oscb commented 10 months ago

Will be fixed in the next version release. Enabling Typescript's skipLibCheck also helps.

i8ramin commented 10 months ago

I am getting TS errors as well. Adding skipLibCheck did not help.

"typescript": "^4.5.5"
"@segment/analytics-react-native": "^2.15.0",
"@segment/analytics-react-native-plugin-appsflyer": "^0.5.2",
"@segment/sovran-react-native": "^1.0.0",
Type checking the mobile package...
yarn run v1.18.0
$ tsc --noEmit -p packages/mobile/tsconfig.json
packages/mobile/node_modules/@segment/sovran-react-native/lib/typescript/src/index.d.ts:1:28 - error TS1005: ',' expected.

1 export { createStore, type Store, type Notify, type Unsubscribe, } from './store';
                             ~~~~~

packages/mobile/node_modules/@segment/sovran-react-native/lib/typescript/src/index.d.ts:1:40 - error TS1005: ',' expected.

1 export { createStore, type Store, type Notify, type Unsubscribe, } from './store';
                                         ~~~~~~

packages/mobile/node_modules/@segment/sovran-react-native/lib/typescript/src/index.d.ts:1:53 - error TS1005: ',' expected.

1 export { createStore, type Store, type Notify, type Unsubscribe, } from './store';
                                                      ~~~~~~~~~~~
{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "jsx": "react",
    "strict": true,
    "baseUrl": "../../",
    "module": "esnext",
    "skipLibCheck": true
  },
  "exclude": [
    "../../node_modules",
    "./node_modules",
    "node_modules",
    "**/node_modules/**"
  ]
}