0

a turborepo projexc:

apps
  web
packages
  api
    types
  common
    intex.tsx

in my api/types, I add 'match' interface

api/types/index.ts

declare namespace API {
  export interface Item {...}
  export interface Match {...}
}

in common/index.tsx I used these interface like:

common/index.tsx

interface Prop {
  value: API.Item | undefined;
}

const Analysis = ({ value }: Prop) => {
  const [aiMatch, setAiMatch] = useState<API.Match>();
  ....
  }



common/package.json

{
  "name": "common",
  "version": "0.0.0",
  "main": "./index.tsx",
  "types": "./index.tsx",
  "license": "MIT",
  "scripts": {
    "lint": "eslint \"**/*.ts*\"",
    "generate:component": "turbo gen react-component"
  },
  "devDependencies": {
    "@types/react": "^18.2.14",
    "@types/react-dom": "^18.2.0",
    "api": "*",
    "constants": "*",
    "eslint": "^7.32.0",
    "eslint-config-custom": "*",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-i18next": "^13.0.2",
    "sass": "^1.63.5",
    "tsconfig": "*",
    "typescript": "^4.5.2",
    "utils": "*"
  }
}

root package.json is

 "dev:web": "dotenv -e ./.env.development -- turbo run dev --scope=web",
 "build:web": "dotenv -e ./.env.production turbo run build --filter=web",

when I run : npm run dev:web ,everything is ok, but npm run build:web, have Type error: Namespace 'API' has no exported member 'Match'.

why? and why namespace API.Item is right? Is package has no updated content?

PLEASE HELP

I have tried deleting common/node_module, deleting apps/web/node_module, and update api folder typescript version, but nothing worked

geeky01adarsh
  • 312
  • 3
  • 14
Andersen
  • 1
  • 1

0 Answers0