├── packages ├── server │ ├── src │ │ ├── index.ts │ │ ├── router │ │ │ ├── index.ts │ │ │ └── todoRouter.ts │ │ ├── lib │ │ │ ├── prismaClient.ts │ │ │ └── trpc.ts │ │ └── main.ts │ ├── .gitignore │ ├── prisma │ │ └── schema.prisma │ ├── package.json │ └── tsconfig.json └── client │ ├── src │ ├── vite-env.d.ts │ ├── index.css │ ├── assets │ │ ├── express.png │ │ ├── trpc.svg │ │ └── react.svg │ ├── lib │ │ └── trpc.ts │ ├── main.tsx │ ├── components │ │ ├── GetTodoById.tsx │ │ ├── AddTodo.tsx │ │ └── ListTodos.tsx │ ├── App.css │ └── App.tsx │ ├── postcss.config.cjs │ ├── vite.config.ts │ ├── tailwind.config.cjs │ ├── tsconfig.node.json │ ├── .gitignore │ ├── index.html │ ├── tsconfig.json │ ├── package.json │ └── public │ └── vite.svg ├── .gitignore ├── .vscode └── settings.json ├── package.json └── README.md /packages/server/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from './router' 2 | -------------------------------------------------------------------------------- /packages/client/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/client/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /packages/server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | # Keep environment variables out of version control 3 | .env 4 | -------------------------------------------------------------------------------- /packages/client/postcss.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/client/src/assets/express.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trulymittal/t3-app-with-express-react-vite-trpc-prisma/HEAD/packages/client/src/assets/express.png -------------------------------------------------------------------------------- /packages/client/src/lib/trpc.ts: -------------------------------------------------------------------------------- 1 | import { createTRPCReact } from '@trpc/react-query' 2 | import type { AppRouter } from 'server' 3 | 4 | export const trpc = createTRPCReact() 5 | -------------------------------------------------------------------------------- /packages/client/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite' 2 | import react from '@vitejs/plugin-react' 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | plugins: [react()], 7 | }) 8 | -------------------------------------------------------------------------------- /packages/server/src/router/index.ts: -------------------------------------------------------------------------------- 1 | import { trpc } from '../lib/trpc' 2 | import { todoRouter } from './todoRouter' 3 | 4 | export const appRouter = trpc.router({ 5 | todo: todoRouter, 6 | }) 7 | 8 | export type AppRouter = typeof appRouter 9 | -------------------------------------------------------------------------------- /packages/client/tailwind.config.cjs: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [require('@tailwindcss/forms')], 8 | } 9 | -------------------------------------------------------------------------------- /packages/client/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "module": "ESNext", 5 | "moduleResolution": "Node", 6 | "allowSyntheticDefaultImports": true 7 | }, 8 | "include": ["vite.config.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/client/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import App from './App' 4 | import './index.css' 5 | 6 | ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( 7 | 8 | 9 | , 10 | ) 11 | -------------------------------------------------------------------------------- /packages/server/src/lib/prismaClient.ts: -------------------------------------------------------------------------------- 1 | import { PrismaClient } from '@prisma/client' 2 | 3 | const globalForPrisma = globalThis as unknown as { prisma: PrismaClient } 4 | 5 | export const prisma = globalForPrisma.prisma || new PrismaClient() 6 | 7 | if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | 15 | node_modules 16 | 17 | */node_modules 18 | *.env 19 | *.env.local 20 | 21 | *build 22 | 23 | # Prisma sqlite 24 | *dev.db* 25 | *migrations* -------------------------------------------------------------------------------- /packages/client/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /packages/client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Vite + React + TS 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": false, 4 | "**/.svn": true, 5 | "**/.hg": true, 6 | "**/CVS": true, 7 | "**/.DS_Store": true, 8 | "**/Thumbs.db": true, 9 | "**/.classpath": true, 10 | "**/.project": true, 11 | "**/.settings": true, 12 | "**/.factorypath": true, 13 | "**/node_modules": true 14 | }, 15 | "editor.codeActionsOnSave": { 16 | "source.organizeImports": false 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/server/prisma/schema.prisma: -------------------------------------------------------------------------------- 1 | // This is your Prisma schema file, 2 | // learn more about it in the docs: https://pris.ly/d/prisma-schema 3 | 4 | generator client { 5 | provider = "prisma-client-js" 6 | } 7 | 8 | datasource db { 9 | provider = "sqlite" 10 | // url = env("DATABASE_URL") 11 | url = "file:./dev.db.sqlite" 12 | } 13 | 14 | model Todo { 15 | id String @id @default(cuid()) 16 | title String 17 | isCompleted Boolean 18 | createdAt DateTime @default(now()) 19 | updatedAt DateTime @updatedAt 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "t3-app-1", 3 | "version": "1.0.0", 4 | "description": "Starter project for ExpressJS with React + Vite using tRPC", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "npm run dev --workspace=client & npm run dev --workspace=server" 8 | }, 9 | "workspaces": [ 10 | "./packages/client", 11 | "./packages/server" 12 | ], 13 | "keywords": [ 14 | "ExpressJS", 15 | "React", 16 | "Vite", 17 | "tRPC", 18 | "typescript" 19 | ], 20 | "author": "Truly Mittal (https://www.trulymittal.com/)", 21 | "license": "ISC" 22 | } 23 | -------------------------------------------------------------------------------- /packages/client/src/components/GetTodoById.tsx: -------------------------------------------------------------------------------- 1 | export default function GetTodoById() { 2 | return ( 3 | <> 4 |
5 | 10 | 13 |
14 |

Hi from Mafia codes

15 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /packages/client/src/App.css: -------------------------------------------------------------------------------- 1 | .logo { 2 | height: 6em; 3 | padding: 1.5em; 4 | will-change: filter; 5 | } 6 | .logo:hover { 7 | filter: drop-shadow(0 0 2em #646cffaa); 8 | } 9 | .logo.react:hover { 10 | filter: drop-shadow(0 0 2em #61dafbaa); 11 | } 12 | 13 | @keyframes logo-spin { 14 | from { 15 | transform: rotate(0deg); 16 | } 17 | to { 18 | transform: rotate(360deg); 19 | } 20 | } 21 | 22 | @media (prefers-reduced-motion: no-preference) { 23 | a:nth-of-type(2) .logo { 24 | animation: logo-spin infinite 20s linear; 25 | } 26 | } 27 | 28 | .card { 29 | padding: 2em; 30 | } 31 | 32 | .read-the-docs { 33 | color: #888; 34 | } 35 | -------------------------------------------------------------------------------- /packages/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 6 | "allowJs": false, 7 | "skipLibCheck": true, 8 | "esModuleInterop": false, 9 | "allowSyntheticDefaultImports": true, 10 | "strict": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "module": "ESNext", 13 | "moduleResolution": "Node", 14 | "resolveJsonModule": true, 15 | "isolatedModules": true, 16 | "noEmit": true, 17 | "jsx": "react-jsx" 18 | }, 19 | "include": ["src"], 20 | "references": [{ "path": "./tsconfig.node.json" }] 21 | } 22 | -------------------------------------------------------------------------------- /packages/server/src/lib/trpc.ts: -------------------------------------------------------------------------------- 1 | import { inferAsyncReturnType, initTRPC, TRPCError } from '@trpc/server' 2 | import * as trpcExpress from '@trpc/server/adapters/express' 3 | 4 | export const createContext = ({ 5 | req, 6 | res, 7 | }: trpcExpress.CreateExpressContextOptions) => { 8 | // req. 9 | const token = req.headers.authorization 10 | // Validate token 11 | // Get the user 12 | const user = 'Truly' 13 | 14 | const noUser = undefined 15 | 16 | if (user) { 17 | throw new TRPCError({ 18 | code: 'UNAUTHORIZED', 19 | message: 'You are not authorized', 20 | }) 21 | } 22 | 23 | return { 24 | user: user, 25 | } 26 | } 27 | 28 | type Context = inferAsyncReturnType 29 | export const trpc = initTRPC.context().create() 30 | -------------------------------------------------------------------------------- /packages/server/src/main.ts: -------------------------------------------------------------------------------- 1 | import express, { Application, NextFunction, Request, Response } from 'express' 2 | import * as trpcExpress from '@trpc/server/adapters/express' 3 | import { appRouter } from './router' 4 | import cors from 'cors' 5 | import { createContext } from './lib/trpc' 6 | 7 | const app: Application = express() 8 | app.use(cors()) 9 | 10 | // app.get('/', (req: Request, res: Response, next: NextFunction) => { 11 | // res.json({ message: 'Hello world!' }) 12 | // }) 13 | 14 | app.use( 15 | '/trpc', 16 | trpcExpress.createExpressMiddleware({ 17 | router: appRouter, 18 | createContext: createContext, 19 | }) 20 | ) 21 | 22 | const PORT: number = Number(process.env.PORT) || 3000 23 | app.listen(PORT, () => { 24 | console.log(`🚀 Server running on Port: ${PORT}`) 25 | }) 26 | -------------------------------------------------------------------------------- /packages/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "./src/index.ts", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "ts-node-dev ./src/main.ts", 9 | "start": "node ./build/main.js" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@types/express": "^4.17.16", 16 | "@types/node": "^18.11.18", 17 | "prisma": "^4.9.0", 18 | "ts-node": "^10.9.1", 19 | "ts-node-dev": "^2.0.0", 20 | "typescript": "^4.9.5" 21 | }, 22 | "dependencies": { 23 | "@prisma/client": "^4.9.0", 24 | "@trpc/server": "^10.10.0", 25 | "@types/cors": "^2.8.13", 26 | "cors": "^2.8.5", 27 | "express": "^4.18.2", 28 | "zod": "^3.20.6" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "client", 3 | "private": true, 4 | "version": "0.0.0", 5 | "type": "module", 6 | "scripts": { 7 | "dev": "vite", 8 | "build": "tsc && vite build", 9 | "preview": "vite preview" 10 | }, 11 | "dependencies": { 12 | "@tanstack/react-query": "^4.24.4", 13 | "@trpc/client": "^10.10.0", 14 | "@trpc/react-query": "^10.10.0", 15 | "@trpc/server": "^10.10.0", 16 | "react": "^18.2.0", 17 | "react-dom": "^18.2.0", 18 | "server": "^1.0.0" 19 | }, 20 | "devDependencies": { 21 | "@tailwindcss/forms": "^0.5.3", 22 | "@types/react": "^18.0.26", 23 | "@types/react-dom": "^18.0.9", 24 | "@vitejs/plugin-react": "^3.0.0", 25 | "autoprefixer": "^10.4.13", 26 | "postcss": "^8.4.21", 27 | "tailwindcss": "^3.2.4", 28 | "typescript": "^4.9.3", 29 | "vite": "^4.0.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /packages/client/src/components/AddTodo.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'react' 2 | import { trpc } from '../lib/trpc' 3 | 4 | export default function AddTodo() { 5 | const [title, setTitle] = useState('') 6 | const addTodoMutation = trpc.todo.create.useMutation() 7 | const trpcContext = trpc.useContext() 8 | return ( 9 |
10 | setTitle(e.target.value)} 13 | type='text' 14 | placeholder='Get milk...' 15 | className='flex-grow rounded-md' 16 | /> 17 | 33 |
34 | ) 35 | } 36 | -------------------------------------------------------------------------------- /packages/server/src/router/todoRouter.ts: -------------------------------------------------------------------------------- 1 | import { prisma } from '../lib/prismaClient' 2 | import { trpc } from '../lib/trpc' 3 | import { z } from 'zod' 4 | 5 | export const todoRouter = trpc.router({ 6 | list: trpc.procedure.query(({ ctx }) => { 7 | console.log(ctx.user) 8 | // const todos = await prisma.todo.findMany() 9 | // return todos 10 | return prisma.todo.findMany() 11 | }), 12 | create: trpc.procedure 13 | .input(z.object({ title: z.string() })) 14 | .mutation(({ input }) => { 15 | const title = input.title 16 | return prisma.todo.create({ 17 | data: { 18 | title: title, 19 | isCompleted: false, 20 | }, 21 | }) 22 | }), 23 | delete: trpc.procedure 24 | .input(z.object({ id: z.string() })) 25 | .mutation(({ input }) => { 26 | return prisma.todo.delete({ 27 | where: { 28 | id: input.id, 29 | }, 30 | }) 31 | }), 32 | update: trpc.procedure 33 | .input(z.object({ id: z.string(), isCompleted: z.boolean() })) 34 | .mutation(({ ctx, input }) => { 35 | return prisma.todo.update({ 36 | where: { 37 | id: input.id, 38 | }, 39 | data: { 40 | isCompleted: input.isCompleted, 41 | }, 42 | }) 43 | }), 44 | }) 45 | -------------------------------------------------------------------------------- /packages/client/src/assets/trpc.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/client/src/App.tsx: -------------------------------------------------------------------------------- 1 | import { QueryClient, QueryClientProvider } from '@tanstack/react-query' 2 | import { httpBatchLink } from '@trpc/client' 3 | import { useState } from 'react' 4 | import './App.css' 5 | import expressLogo from './assets/express.png' 6 | import reactLogo from './assets/react.svg' 7 | import tRpcLogo from './assets/trpc.svg' 8 | import AddTodo from './components/AddTodo' 9 | import ListTodos from './components/ListTodos' 10 | import { trpc } from './lib/trpc' 11 | 12 | function App() { 13 | const [queryClient] = useState(() => new QueryClient()) 14 | const [trpcClient] = useState(() => { 15 | return trpc.createClient({ 16 | links: [ 17 | httpBatchLink({ 18 | url: 'http://localhost:3000/trpc', 19 | }), 20 | ], 21 | }) 22 | }) 23 | 24 | return ( 25 | 26 | 27 |
28 |
29 |

Vite + React | Express | tRPC

30 |

npm workspaces

31 |
32 |
33 | 34 | 35 |
36 |
37 |
38 |
39 | ) 40 | } 41 | 42 | export default App 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tRPC + Express + React (with Vite) Scaffolding 2 | 3 | This is a minimal monorepo for Express.js as backend and React frontend with tRPC support. Which is can be used as a starting point for any express trpc react application, with prisma. 4 | 5 | ## Clone and install dependencies 🏭 6 | 7 | ```bash 8 | $ git clone https://github.com/trulymittal/t3-app-with-express-react-vite-trpc-prisma.git 9 | $ cd t3-app-with-express-react-vite-trpc-prisma 10 | $ npm i --workspaces 11 | # Only if using the prisma ORM 12 | $ npx prisma db push 13 | ``` 14 | 15 | ## Why another tRPC + Express + React boilerplate generator ❓ 16 | 17 | 1. Only installs the bare bones 💀 and "mostly" required dependencies whenever you try to start a new trpc express react application in a monorepo. 18 | 2. Example TODO router, i.e. CRUD operations are demonstrated on the frontend React and backend express application, to give you an idea of how trpc works 19 | 20 | ## Quick Start 🏃‍♂️ 21 | 22 | The quickest way to get started is to clone the project and install the dependencies using: 23 | 24 | ```bash 25 | $ npm i --workspaces 26 | $ npm run dev 27 | ``` 28 | 29 | ## Author ✍️ 30 | 31 | [**Truly Mittal 🇮🇳**](https://trulymittal.com) 32 | 33 | ## YouTube 📺 34 | 35 | https://youtube.com/@mafiacodes 36 | 37 | ## Donations 💰 38 | 39 | https://paypal.me/trulymittal 40 | 41 | ## License 🎫 42 | 43 | [MIT](LICENSE) 44 | 45 | ## Contribute 🤝 46 | 47 | You can fork this repo and send me a PR. 48 | -------------------------------------------------------------------------------- /packages/client/public/vite.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/client/src/components/ListTodos.tsx: -------------------------------------------------------------------------------- 1 | import { trpc } from '../lib/trpc' 2 | 3 | export default function ListTodos() { 4 | function handleDelete() {} 5 | function updateTodo() {} 6 | 7 | const response = trpc.todo.list.useQuery() 8 | const deleteMutation = trpc.todo.delete.useMutation() 9 | const updateMutation = trpc.todo.update.useMutation() 10 | const trpcContext = trpc.useContext() 11 | 12 | if (response.isError) { 13 | return

Error...

14 | } 15 | 16 | if (response.isLoading) { 17 | return

Loading...

18 | } 19 | 20 | return ( 21 |
    22 | {response.data.map(todo => { 23 | return ( 24 |
  • 28 |

    {todo.title}

    29 | 30 | 41 | 42 | 70 |
  • 71 | ) 72 | })} 73 |
74 | ) 75 | } 76 | -------------------------------------------------------------------------------- /packages/client/src/assets/react.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | 5 | /* Projects */ 6 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 7 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 8 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 9 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 10 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 11 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 12 | 13 | /* Language and Environment */ 14 | "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, 15 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 16 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 17 | // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ 18 | // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 19 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 20 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 21 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 22 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 23 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 24 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 25 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 26 | 27 | /* Modules */ 28 | "module": "commonjs" /* Specify what module code is generated. */, 29 | "rootDir": "./src" /* Specify the root folder within your source files. */, 30 | "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, 31 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 32 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 33 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 34 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 35 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 36 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 37 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 38 | // "resolveJsonModule": true, /* Enable importing .json files. */ 39 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 40 | 41 | /* JavaScript Support */ 42 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 43 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 44 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 45 | 46 | /* Emit */ 47 | // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ 48 | // "declarationMap": true, /* Create sourcemaps for d.ts files. */ 49 | // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ 50 | // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ 51 | // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ 52 | "outDir": "./build" /* Specify an output folder for all emitted files. */, 53 | // "removeComments": true, /* Disable emitting comments. */ 54 | // "noEmit": true, /* Disable emitting files from a compilation. */ 55 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 56 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 57 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 58 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 59 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 60 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 61 | // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ 62 | // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ 63 | // "newLine": "crlf", /* Set the newline character for emitting files. */ 64 | // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ 65 | // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ 66 | // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ 67 | // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ 68 | // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ 69 | // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ 70 | 71 | /* Interop Constraints */ 72 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 73 | // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ 74 | "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, 75 | // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ 76 | "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, 77 | 78 | /* Type Checking */ 79 | "strict": true /* Enable all strict type-checking options. */, 80 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 81 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 82 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 83 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 84 | // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ 85 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 86 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 87 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 88 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 89 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 90 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 91 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 92 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 93 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 94 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 95 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 96 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 97 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 98 | 99 | /* Completeness */ 100 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 101 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 102 | }, 103 | "include": ["./src"] 104 | } 105 | --------------------------------------------------------------------------------