TypeScript

プロジェクトに TypeScript が必要な場合はパッケージのインストールと設定を行います。

Table of Contents

Install

$ npm install --save-dev typescript @types/react @types/react-dom

Config

tsconfig.jsonminista/client を追加することで、minista の型定義(MDX・Markdown・Island)と Vite の型定義が利用できます。

$ touch ./tsconfig.json
./tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "noErrorTruncation": true,
    "jsx": "react-jsx",
    "types": ["minista/client"]
  },
  "exclude": ["node_modules", "dist"]
}