Skip to content

UserResource types are in disagreement in @clerk/clerk-expo and @clerk/types in version 2.2.5 #4105

@the-simian

Description

@the-simian

Preliminary Checks

Reproduction

n/a

Publishable key

pk_test_Y2hvaWNlLXBlYWNvY2stMy5jbGVyay5hY2NvdW50cy5kZXYk

Description

I am this issue with clerk-expo

I was able to get past this on 2.2.7 but after downgrading because of #4084 the window problem to 2.2.5 this problem is back.

//this type
import type { UserResource } from '@clerk/types';
const { useUser } from '@clerk/clerk-expo';

//is not the same as the type returned from this.
const { user } = useUser(); // typeof UserResourceReturn

//when I do something like this:
function myFunction(user: UserResource) {
  //do stuff with the user.
}

if (!user) return;  //user must exist for the next line.
myFunction(user);

I will get the following:

Argument of type 'import("/my-project/node_modules/@clerk/clerk-expo/node_modules/@clerk/types/dist/index").UserResource' is not assignable to parameter of type 'import("/my-project/node_modules/@clerk/types/dist/index").UserResource'.
  Types of property 'primaryWeb3Wallet' are incompatible.
    Type 'import("/my-project/node_modules/@clerk/clerk-expo/node_modules/@clerk/types/dist/index").Web3WalletResource | null' is not assignable to type 'import("/my-project/node_modules/@clerk/types/dist/index").Web3WalletResource | null'.
      Type 'import("/my-project/node_modules/@clerk/clerk-expo/node_modules/@clerk/types/dist/index").Web3WalletResource' is not assignable to type 'import("/my-project/node_modules/@clerk/types/dist/index").Web3WalletResource'.
        Types of property 'prepareVerification' are incompatible.
          Type '(params: import("/my-project/node_modules/@clerk/clerk-expo/node_modules/@clerk/types/dist/index").PrepareWeb3WalletVerificationParams) => Promise<...>' is not assignable to type '(params: import("/my-project/node_modules/@clerk/types/dist/index").PrepareWeb3WalletVerificationParams) => Promise<...>'.
            Types of parameters 'params' and 'params' are incompatible.
              Type 'import("/my-project/node_modules/@clerk/types/dist/index").PrepareWeb3WalletVerificationParams' is not assignable to type 'import("/my-project/node_modules/@clerk/clerk-expo/node_modules/@clerk/types/dist/index").PrepareWeb3WalletVerificationParams'.
                Types of property 'strategy' are incompatible.
                  Type '"web3_coinbase_signature" | "web3_metamask_signature" | "web3_coinbase_wallet_signature"' is not assignable to type '"web3_coinbase_signature" | "web3_metamask_signature"'.
                    Type '"web3_coinbase_wallet_signature"' is not assignable to type '"web3_coinbase_signature" | "web3_metamask_signature"'. Did you mean '"web3_coinbase_signature"'?
                                        

Additional Info:
This was working before version 2.x.x with no tsc errors.

There is a similar issue here: #2176 , but the issue seemed slightly different so I am opening this issue.

Environment

This isn't relevant to this issue, but here's the output. Its a hybrid mobile/native expo project.
  

  System:
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
    Memory: 56.93 GB / 62.68 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 22.4.0 - ~/.nvm/versions/node/v22.4.0/bin/node
    npm: 10.8.1 - ~/.nvm/versions/node/v22.4.0/bin/npm
    pnpm: 8.15.1 - ~/.local/share/pnpm/pnpm
    bun: 1.1.18 - ~/.bun/bin/bun  //using this on this project.
  npmPackages:
    @babel/core: 7.25.2 => 7.25.2
    @babel/plugin-proposal-export-namespace-from: ^7.18.9 => 7.18.9
    @babel/plugin-transform-react-jsx: ^7.25.2 => 7.25.2
    @biomejs/biome: 1.8.3 => 1.8.3
    @clerk/backend: ^1.9.2 => 1.9.2
    @clerk/clerk-expo: 2.2.5 => 2.2.5
    @clerk/clerk-react: ^5.7.0 => 5.7.0
    @expo/config: 9.0.3 => 9.0.3
    @expo/metro-runtime: ~3.2.3 => 3.2.3
    @expo/ngrok: 4.1.3 => 4.1.3
    @expo/vector-icons: 14.0.2 => 14.0.2
    @react-native-async-storage/async-storage: 1.23.1 => 1.23.1
    @react-native-community/datetimepicker: 8.0.1 => 8.0.1
    @react-native-community/slider: 4.5.2 => 4.5.2
    @react-navigation/drawer: 6.7.2 => 6.7.2
    @react-navigation/material-top-tabs: ^6.6.14 => 6.6.14
    @react-navigation/native: 6.1.18 => 6.1.18
    @sentry/react-native: ~5.22.0 => 5.22.3
    @shopify/flash-list: 1.6.4 => 1.6.4
    @types/bun: ^1.1.8 => 1.1.8
    @types/jsonwebtoken: ^9.0.6 => 9.0.6
    @types/react: ~18.2.79 => 18.2.79
    expo: ~51.0.31 => 51.0.32
    expo-application: 5.9.1 => 5.9.1
    expo-av: ~14.0.7 => 14.0.7
    expo-build-properties: ~0.12.5 => 0.12.5
    expo-camera: ~15.0.15 => 15.0.15
    expo-clipboard: 6.0.3 => 6.0.3
    expo-constants: ~16.0.2 => 16.0.2
    expo-crypto: 13.0.2 => 13.0.2
    expo-dev-client: ~4.0.25 => 4.0.26
    expo-device: ~6.0.2 => 6.0.2
    expo-doctor: ^1.10.1 => 1.10.1
    expo-font: ~12.0.9 => 12.0.10
    expo-haptics: 13.0.1 => 13.0.1
    expo-image-picker: ~15.0.7 => 15.0.7
    expo-linear-gradient: 13.0.2 => 13.0.2
    expo-linking: 6.3.1 => 6.3.1
    expo-local-authentication: ^14.0.1 => 14.0.1
    expo-navigation-bar: ~3.0.7 => 3.0.7
    expo-notifications: ~0.28.16 => 0.28.16
    expo-router: ~3.5.23 => 3.5.23
    expo-secure-store: ~13.0.2 => 13.0.2
    expo-server-sdk: 3.10.0 => 3.10.0
    expo-splash-screen: ~0.27.5 => 0.27.5
    expo-status-bar: 1.12.1 => 1.12.1
    expo-system-ui: ~3.0.7 => 3.0.7
    expo-updates: ~0.25.24 => 0.25.24
    expo-web-browser: 13.0.3 => 13.0.3
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    react-hook-form: 7.52.2 => 7.52.2
    react-native: 0.74.5 => 0.74.5
    react-native-apollo-devtools-client: ^1.0.4 => 1.0.4
    react-native-calendars: 1.1306.0 => 1.1306.0
    react-native-email-link: ^1.16.1 => 1.16.1
    react-native-gesture-handler: ~2.16.1 => 2.16.2
    react-native-gifted-chat: ^2.4.0 => 2.6.2
    react-native-pager-view: 6.3.0 => 6.3.0
    react-native-reanimated: ~3.10.1 => 3.10.1
    react-native-safe-area-context: 4.10.5 => 4.10.5
    react-native-screens: 3.31.1 => 3.31.1
    react-native-svg: 15.2.0 => 15.2.0
    react-native-tab-view: ^3.5.2 => 3.5.2
    react-native-toast-message: 2.2.0 => 2.2.0
    react-native-video: ^6.4.3 => 6.5.0
    react-native-web: ~0.19.12 => 0.19.12
    react-test-renderer: 18.2.0 => 18.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions