Skip to content

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

Closed
@ImBIOS

Description

@ImBIOS

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions