Hi, I’m setting up the React Native SDK. I added t...
# support
e
Hi, I’m setting up the React Native SDK. I added the
@rudderstack/rudder-sdk-react-native
package, installed pods, and added the
await rudderClient.setup(...)
call to the
App.tsx
. I noticed there’s a problem with top-level await, so I added
"module": "esnext"
to the
compilerOptions
in our
tsconfig.json
. I wanted to verify the typescript setup is correct, so I ran
yarn tsc
. I got 3 errors, all of them coming from
node_modules/@rudderstack/rudder-sdk-react-native/src/RudderClient.ts
. The first two were related to the
async-lock
package - the types were not available. I worked around this by adding the
@types/async-lock
package. The last one is this:
Copy code
node_modules/@rudderstack/rudder-sdk-react-native/src/RudderClient.ts:191:16 - error TS2394: This overload signature is not compatible with its implementation signature.

191 async function alias(previousId: string, userId: string | Record<string, unknown>): Promise<void>;
                   ~~~~~

  node_modules/@rudderstack/rudder-sdk-react-native/src/RudderClient.ts:192:16
    192 async function alias(newId: string, options: Record<string, unknown> | null = null) {
                       ~~~~~
    The implementation signature is declared here.
Any help here? I can’t see the typecheck run as part of your CI workflows (https://github.com/rudderlabs/rudder-sdk-react-native/tree/master/.github/workflows), so maybe this issue is present in the repo and the check would have caught it? Anyway, I’m not sure why typescript checks the node_modules, probably because you ship
.ts
files, not built
.js
+
.d.ts
. I have
skipLibChecks: true
in
tsconfig.json
.
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
e
reading this thread, it’s mentioned many times that publishing
.ts
files (at least without
.d.ts
) is basically wrong: https://github.com/microsoft/TypeScript/issues/40426#issuecomment-1373454802
one finding - the type error is only present with the
"strict": true
option in
tsconfig.json
. I’d like to suggest you to conform to the strict rules as well to solve this problem. I will turn it off on our side as a temporary workaround.
h
@eager-pizza-76165, We are looking into it. CC <!subteam^S04QT1G74Q3|@sdk-team>
c
Hey @eager-pizza-76165, thank you for bringing this to our attention. We will investigate this issue. Meanwhile, please raise a bug report for this issue by following the link to our GitHub issue page: https://github.com/rudderlabs/rudder-sdk-react-native/issues/new?assignees=1abhish[…]2C+open+source&template=bug_report.md&title=BUG+%3A+%3CTitle%3E
e
c
Thanks for raising the issue. I’ve discussed this with the team and we will provide a fix (i.e., clean up the generated packages to avoid throwing type issues) for this in the future, as it is currently not causing any blockers for you.
e
thanks 🙇