Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@clerk/clerk-expo/dist/cache/types' or its corresponding type declarations. ts(2307) #5314

Closed
4 tasks done
ImBIOS opened this issue Mar 10, 2025 · 0 comments · Fixed by #5358
Closed
4 tasks done
Assignees
Labels

Comments

@ImBIOS
Copy link

ImBIOS commented Mar 10, 2025

Preliminary Checks

Reproduction

none

Publishable key

none

Description

Steps to reproduce:

import { Platform } from "react-native";
import * as SecureStore from "expo-secure-store";
import { TokenCache } from "@clerk/clerk-expo/dist/cache";

const createTokenCache = (): TokenCache => {
  return {
    getToken: async (key: string) => {
      try {
        const item = await SecureStore.getItemAsync(key);
        if (item) {
          console.log(`${key} was used 🔐 \n`);
        } else {
          console.log("No values stored under key: " + key);
        }
        return item;
      } catch (error) {
        console.error("secure store get item error: ", error);
        await SecureStore.deleteItemAsync(key);
        return null;
      }
    },
    saveToken: (key: string, token: string) => {
      return SecureStore.setItemAsync(key, token);
    },
  };
};

// SecureStore is not supported on the web
export const tokenCache =
  Platform.OS !== "web" ? createTokenCache() : undefined;

this cache.ts will throw error because in package.json of expo package it's not officially exported, in some safe behavior like my pnpm projects, it will not properly link.

Expected behavior:

types working properly

Actual behavior:

Cannot find module '@clerk/clerk-expo/dist/cache' or its corresponding type declarations. ts (2307)

Suggested Solution

add cache to the library supported export

Environment

System:
    OS: macOS 14.7.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 102.00 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.0 - ~/.asdf/installs/nodejs/22.13.0/bin/node
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
    pnpm: 8.15.8 - ~/.asdf/installs/pnpm/8.15.8/bin/pnpm
    Watchman: 2025.02.17.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 134.0.6998.45
    Safari: 17.6
  npmPackages:
    @dietthing/eslint-config: workspace:* => 0.3.0 
    @dietthing/prettier-config: workspace:* => 0.1.0 
    @dietthing/tailwind-config: workspace:* => 0.1.0 
    @dietthing/tsconfig: workspace:* => 0.0.1 
    react-native-tab-view: ^3.5.2 => 3.5.2
@ImBIOS ImBIOS added the needs-triage A ticket that needs to be triaged by a team member label Mar 10, 2025
ImBIOS added a commit to ImBIOS/clerk-javascript that referenced this issue Mar 10, 2025
@LekoArts LekoArts self-assigned this Mar 10, 2025
@LekoArts LekoArts added expo and removed needs-triage A ticket that needs to be triaged by a team member labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants