├── .gitignore ├── src ├── index.ts ├── routes │ ├── profesoresRoutes.ts │ ├── estudiantesRoutes.ts │ └── cursosRoutes.ts ├── db │ └── conexion.ts ├── models │ ├── estudianteModel.ts │ ├── profesoresModel.ts │ └── cursoModel.ts ├── app.ts └── controllers │ ├── profesoresController.ts │ ├── estudiantesController.ts │ └── cursosController.ts ├── package.json ├── README.md └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import app from './app'; 2 | import { AppDataSource } from './db/conexion'; 3 | 4 | async function main() { 5 | try { 6 | await AppDataSource.initialize(); 7 | console.log("Base de datos conectada"); 8 | app.listen(6505, () => { 9 | console.log("Server activo"); 10 | }); 11 | } catch (err) { 12 | if (err instanceof Error) { 13 | console.log(err.message); 14 | } 15 | } 16 | 17 | } 18 | 19 | main(); -------------------------------------------------------------------------------- /src/routes/profesoresRoutes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import profesoresController from '../controllers/profesoresController'; 3 | const router = express.Router(); 4 | 5 | 6 | router.get('/', profesoresController.consultar); 7 | 8 | router.post('/', profesoresController.ingresar); 9 | 10 | router.route("/:id") 11 | .get(profesoresController.consultarDetalle) 12 | .put(profesoresController.actualizar) 13 | .delete(profesoresController.borrar); 14 | 15 | 16 | export default router; 17 | -------------------------------------------------------------------------------- /src/routes/estudiantesRoutes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import estudiantesController from '../controllers/estudiantesController'; 3 | const router = express.Router(); 4 | 5 | 6 | router.get('/', estudiantesController.consultar); 7 | 8 | router.post('/', estudiantesController.ingresar); 9 | 10 | router.route("/:id") 11 | .get(estudiantesController.consultarDetalle) 12 | .put(estudiantesController.actualizar) 13 | .delete(estudiantesController.borrar); 14 | 15 | export default router; 16 | -------------------------------------------------------------------------------- /src/db/conexion.ts: -------------------------------------------------------------------------------- 1 | import { DataSource } from "typeorm"; 2 | import { Estudiante } from "../models/estudianteModel"; 3 | import { Profesor } from "../models/profesoresModel"; 4 | import { Curso } from "../models/cursoModel"; 5 | 6 | export const AppDataSource = new DataSource({ 7 | type: "mysql", 8 | host: "ip-server", 9 | port: 3306, 10 | username: "nombre-usuario", 11 | password: "clave", 12 | database: "nombre-bd", 13 | logging: true, 14 | entities: [Estudiante, Profesor, Curso], 15 | synchronize: false 16 | 17 | }); -------------------------------------------------------------------------------- /src/routes/cursosRoutes.ts: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | import cursosController from '../controllers/cursosController'; 3 | const router = express.Router(); 4 | 5 | 6 | router.get('/', cursosController.consultar); 7 | 8 | router.post('/', cursosController.ingresar); 9 | router.post('/registraEstudiante', cursosController.asociarEstudiante); 10 | 11 | router.route("/:id") 12 | .get(cursosController.consultarDetalle) 13 | .put(cursosController.actualizar) 14 | .delete(cursosController.borrar); 15 | 16 | 17 | 18 | export default router; 19 | -------------------------------------------------------------------------------- /src/models/estudianteModel.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm" 2 | 3 | @Entity('estudiantes') 4 | export class Estudiante extends BaseEntity { 5 | 6 | @PrimaryGeneratedColumn() 7 | id: number; 8 | 9 | @Column() 10 | dni: String; 11 | 12 | @Column() 13 | nombre: String; 14 | 15 | @Column() 16 | apellido: String; 17 | 18 | @Column() 19 | email: String; 20 | 21 | @CreateDateColumn() 22 | createdAt: Date; 23 | 24 | @UpdateDateColumn() 25 | updatedAt: Date; 26 | } -------------------------------------------------------------------------------- /src/app.ts: -------------------------------------------------------------------------------- 1 | import express, { Request, Response } from 'express'; 2 | import cors from 'cors'; 3 | import morgan from 'morgan'; 4 | import estudiantesRoutes from './routes/estudiantesRoutes'; 5 | import profesoresRoutes from './routes/profesoresRoutes'; 6 | import cursosRoutes from './routes/cursosRoutes'; 7 | 8 | const app = express(); 9 | 10 | app.use(express.json()); 11 | app.use(morgan('dev')); 12 | app.use(cors()); 13 | 14 | app.get('/', (req: Request, res: Response) => { 15 | console.log('Hola mundo'); 16 | res.send("Hola mundo"); 17 | }); 18 | 19 | app.use("/estudiantes", estudiantesRoutes); 20 | app.use("/profesores", profesoresRoutes); 21 | app.use("/cursos", cursosRoutes); 22 | 23 | export default app; -------------------------------------------------------------------------------- /src/models/profesoresModel.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, CreateDateColumn, Entity, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm" 2 | import { Curso } from "./cursoModel"; 3 | 4 | @Entity('profesores') 5 | export class Profesor extends BaseEntity { 6 | 7 | @PrimaryGeneratedColumn() 8 | id: number; 9 | 10 | @Column() 11 | dni: String; 12 | 13 | @Column() 14 | nombre: String; 15 | 16 | @Column() 17 | apellido: String; 18 | 19 | @Column() 20 | email: String; 21 | 22 | @Column() 23 | profesion: String; 24 | 25 | @Column() 26 | telefono: String; 27 | 28 | @CreateDateColumn() 29 | createdAt: Date; 30 | 31 | @UpdateDateColumn() 32 | updatedAt: Date; 33 | 34 | @OneToMany(() => Curso, (curso) => curso.profesor) 35 | cursos: Curso[] 36 | 37 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "express-typeorm-ts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "ts-node-dev --respawn src/index.ts", 8 | "build": "tsc", 9 | "start": "node build/index.js", 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "@types/cors": "^2.8.17", 17 | "@types/express": "^4.17.21", 18 | "@types/morgan": "^1.9.9", 19 | "@types/node": "^20.12.8", 20 | "ts-node-dev": "^2.0.0", 21 | "typescript": "^5.4.5" 22 | }, 23 | "dependencies": { 24 | "cors": "^2.8.5", 25 | "express": "^4.19.2", 26 | "morgan": "^1.10.0", 27 | "mysql2": "^3.9.7", 28 | "reflect-metadata": "^0.2.2", 29 | "typeorm": "^0.3.20" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/models/cursoModel.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, CreateDateColumn, Entity, JoinColumn, JoinTable, ManyToMany, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; 2 | import { Profesor } from "./profesoresModel"; 3 | import { Estudiante } from "./estudianteModel"; 4 | 5 | @Entity('cursos') 6 | export class Curso extends BaseEntity { 7 | 8 | @PrimaryGeneratedColumn() 9 | id: number; 10 | 11 | @Column() 12 | nombre: String; 13 | 14 | @Column('text') 15 | descripcion: String; 16 | 17 | @CreateDateColumn() 18 | createdAt: Date; 19 | 20 | @UpdateDateColumn() 21 | updatedAt: Date; 22 | 23 | @ManyToOne(() => Profesor, (profesor) => profesor.cursos) 24 | @JoinColumn({ name: 'profesor_id' }) 25 | profesor: Profesor; 26 | 27 | @ManyToMany(() => Estudiante) 28 | @JoinTable({ 29 | name: 'cursos_estudiantes', 30 | joinColumn: { name: 'curso_id' }, 31 | inverseJoinColumn: { name: 'estudiante_id' } 32 | }) 33 | estudiantes: Estudiante[]; 34 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # API Rest con NodeJS + ExpressJS + Typescript + TypeORM 2 | 3 | https://youtu.be/RwkvTRXAqZU 4 | 5 | Configuración del Proyecto: 6 | * Inicialización del proyecto con npm. 7 | * Instalación de TypeScript como dependencia de desarrollo. 8 | * Configuración del archivo tsconfig.json para opciones de compilación. 9 | 10 | Express.js y Rutas: 11 | * Creación de una instancia de Express. 12 | * Configuración para manejar solicitudes JSON. 13 | * Definición de rutas para las operaciones CRUD (crear, leer, actualizar, eliminar) de estudiantes, profesores y cursos. 14 | 15 | TypeORM y Base de Datos: 16 | * Instalación de TypeORM y configuración de la conexión a la base de datos (usaremos PostgreSQL en este ejemplo). 17 | * Creación de entidades (modelos) para estudiantes, profesores y cursos. 18 | * Relaciones entre las entidades (uno a muchos y muchos a muchos). 19 | * Implementación de consultas utilizando TypeORM. 20 | 21 | Beneficios de usar ORMs: 22 | * Abstracción de la capa de base de datos. 23 | * Facilita la creación, consulta y manipulación de datos. 24 | * Evita la escritura manual de consultas SQL. 25 | * Mejora la seguridad y previene ataques de inyección de SQL. 26 | 27 | Ventajas de TypeScript: 28 | * Tipado estático para reducir errores en tiempo de desarrollo. 29 | * Autocompletado y sugerencias en el código. 30 | * Mayor legibilidad y mantenibilidad. 31 | -------------------------------------------------------------------------------- /src/controllers/profesoresController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { Profesor } from "../models/profesoresModel"; 3 | 4 | 5 | class ProfesoresController { 6 | constructor() { 7 | 8 | } 9 | 10 | async consultar(req: Request, res: Response) { 11 | try { 12 | const data = await Profesor.find(); 13 | res.status(200).json(data); 14 | } catch (err) { 15 | if (err instanceof Error) 16 | res.status(500).send(err.message); 17 | } 18 | 19 | } 20 | 21 | async consultarDetalle(req: Request, res: Response) { 22 | const { id } = req.params; 23 | try { 24 | const registro = await Profesor.findOneBy({ id: Number(id) }); 25 | if (!registro) { 26 | throw new Error('Profesor no encontrado'); 27 | } 28 | 29 | res.status(200).json(registro); 30 | } catch (err) { 31 | if (err instanceof Error) 32 | res.status(500).send(err.message); 33 | } 34 | } 35 | 36 | async ingresar(req: Request, res: Response) { 37 | try { 38 | const registro = await Profesor.save(req.body); 39 | res.status(201).json(registro); 40 | } catch (err) { 41 | if (err instanceof Error) 42 | res.status(500).send(err.message); 43 | } 44 | } 45 | 46 | async actualizar(req: Request, res: Response) { 47 | const { id } = req.params; 48 | try { 49 | const registro = await Profesor.findOneBy({ id: Number(id) }); 50 | if (!registro) { 51 | throw new Error('Profesor no encontrado'); 52 | } 53 | await Profesor.update({ id: Number(id) }, req.body); 54 | const registroActualizado = await Profesor.findOneBy({ id: Number(id) }); 55 | res.status(200).json(registroActualizado); 56 | } catch (err) { 57 | if (err instanceof Error) 58 | res.status(500).send(err.message); 59 | } 60 | } 61 | 62 | async borrar(req: Request, res: Response) { 63 | const { id } = req.params; 64 | try { 65 | const registro = await Profesor.findOneBy({ id: Number(id) }); 66 | if (!registro) { 67 | throw new Error('Profesor no encontrado'); 68 | } 69 | await Profesor.delete({ id: Number(id) }); 70 | res.status(204); 71 | } catch (err) { 72 | if (err instanceof Error) 73 | res.status(500).send(err.message); 74 | } 75 | } 76 | } 77 | 78 | export default new ProfesoresController(); -------------------------------------------------------------------------------- /src/controllers/estudiantesController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { Estudiante } from "../models/estudianteModel"; 3 | 4 | 5 | class EstudiantesController { 6 | constructor() { 7 | 8 | } 9 | 10 | async consultar(req: Request, res: Response) { 11 | try { 12 | const data = await Estudiante.find(); 13 | res.status(200).json(data); 14 | } catch (err) { 15 | if (err instanceof Error) 16 | res.status(500).send(err.message); 17 | } 18 | 19 | } 20 | 21 | async consultarDetalle(req: Request, res: Response) { 22 | const { id } = req.params; 23 | try { 24 | const registro = await Estudiante.findOneBy({ id: Number(id) }); 25 | if (!registro) { 26 | throw new Error('Estudiante no encontrado'); 27 | } 28 | 29 | res.status(200).json(registro); 30 | } catch (err) { 31 | if (err instanceof Error) 32 | res.status(500).send(err.message); 33 | } 34 | } 35 | 36 | async ingresar(req: Request, res: Response) { 37 | try { 38 | const registro = await Estudiante.save(req.body); 39 | res.status(201).json(registro); 40 | } catch (err) { 41 | if (err instanceof Error) 42 | res.status(500).send(err.message); 43 | } 44 | } 45 | 46 | async actualizar(req: Request, res: Response) { 47 | const { id } = req.params; 48 | try { 49 | const registro = await Estudiante.findOneBy({ id: Number(id) }); 50 | if (!registro) { 51 | throw new Error('Estudiante no encontrado'); 52 | } 53 | await Estudiante.update({ id: Number(id) }, req.body); 54 | const registroActualizado = await Estudiante.findOneBy({ id: Number(id) }); 55 | res.status(200).json(registroActualizado); 56 | } catch (err) { 57 | if (err instanceof Error) 58 | res.status(500).send(err.message); 59 | } 60 | } 61 | 62 | async borrar(req: Request, res: Response) { 63 | const { id } = req.params; 64 | try { 65 | const registro = await Estudiante.findOneBy({ id: Number(id) }); 66 | if (!registro) { 67 | throw new Error('Estudiante no encontrado'); 68 | } 69 | await Estudiante.delete({ id: Number(id) }); 70 | res.status(204); 71 | } catch (err) { 72 | if (err instanceof Error) 73 | res.status(500).send(err.message); 74 | } 75 | } 76 | } 77 | 78 | export default new EstudiantesController(); -------------------------------------------------------------------------------- /src/controllers/cursosController.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response } from "express"; 2 | import { Curso } from "../models/cursoModel"; 3 | import { Profesor } from "../models/profesoresModel"; 4 | import { Estudiante } from "../models/estudianteModel"; 5 | 6 | 7 | class CursosController { 8 | constructor() { 9 | 10 | } 11 | 12 | async consultar(req: Request, res: Response) { 13 | try { 14 | const data = await Curso.find({ relations: { profesor: true, estudiantes: true } }); 15 | res.status(200).json(data); 16 | } catch (err) { 17 | if (err instanceof Error) 18 | res.status(500).send(err.message); 19 | } 20 | 21 | } 22 | 23 | async consultarDetalle(req: Request, res: Response) { 24 | const { id } = req.params; 25 | try { 26 | const registro = await Curso.findOne({ where: { id: Number(id) }, relations: { profesor: true, estudiantes: true } }); 27 | if (!registro) { 28 | throw new Error('Curso no encontrado'); 29 | } 30 | 31 | res.status(200).json(registro); 32 | } catch (err) { 33 | if (err instanceof Error) 34 | res.status(500).send(err.message); 35 | } 36 | } 37 | 38 | async ingresar(req: Request, res: Response) { 39 | try { 40 | const { profesor } = req.body; 41 | 42 | const profesorRegistro = await Profesor.findOneBy({ id: Number(profesor) }); 43 | if (!profesorRegistro) { 44 | throw new Error('Profesor no encontrado'); 45 | } 46 | 47 | const registro = await Curso.save(req.body); 48 | res.status(201).json(registro); 49 | } catch (err) { 50 | if (err instanceof Error) 51 | res.status(500).send(err.message); 52 | } 53 | } 54 | 55 | async actualizar(req: Request, res: Response) { 56 | const { id } = req.params; 57 | try { 58 | const { profesor } = req.body; 59 | 60 | const profesorRegistro = await Profesor.findOneBy({ id: Number(profesor) }); 61 | if (!profesorRegistro) { 62 | throw new Error('Profesor no encontrado'); 63 | } 64 | 65 | const registro = await Curso.findOneBy({ id: Number(id) }); 66 | if (!registro) { 67 | throw new Error('Curso no encontrado'); 68 | } 69 | await Curso.update({ id: Number(id) }, req.body); 70 | const registroActualizado = await Curso.findOne({ where: { id: Number(id) }, relations: { profesor: true, estudiantes: true } }); 71 | res.status(200).json(registroActualizado); 72 | } catch (err) { 73 | if (err instanceof Error) 74 | res.status(500).send(err.message); 75 | } 76 | } 77 | 78 | async borrar(req: Request, res: Response) { 79 | const { id } = req.params; 80 | try { 81 | const registro = await Curso.findOneBy({ id: Number(id) }); 82 | if (!registro) { 83 | throw new Error('Curso no encontrado'); 84 | } 85 | await Curso.delete({ id: Number(id) }); 86 | res.status(204); 87 | } catch (err) { 88 | if (err instanceof Error) 89 | res.status(500).send(err.message); 90 | } 91 | } 92 | 93 | async asociarEstudiante(req: Request, res: Response) { 94 | const { id } = req.params; 95 | try { 96 | const { estudiante_id, curso_id } = req.body; 97 | const estudiante = await Estudiante.findOneBy({ id: Number(estudiante_id) }); 98 | const curso = await Curso.findOneBy({ id: Number(curso_id) }); 99 | 100 | if (!estudiante) { 101 | throw new Error('Estudiante no encontrado'); 102 | } 103 | if (!curso) { 104 | throw new Error('Curso no encontrado'); 105 | } 106 | 107 | curso.estudiantes = curso.estudiantes || []; 108 | curso.estudiantes.push(estudiante); 109 | 110 | const registro = await Curso.save(curso); 111 | res.status(200).json(registro); 112 | 113 | } catch (err) { 114 | if (err instanceof Error) 115 | res.status(500).send(err.message); 116 | } 117 | } 118 | } 119 | 120 | export default new CursosController(); -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | /* Visit https://aka.ms/tsconfig to read more about this file */ 4 | /* Projects */ 5 | // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ 6 | // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ 7 | // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ 8 | // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ 9 | // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ 10 | // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ 11 | /* Language and Environment */ 12 | "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ 13 | // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ 14 | // "jsx": "preserve", /* Specify what JSX code is generated. */ 15 | "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ 16 | "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ 17 | // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ 18 | // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ 19 | // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ 20 | // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ 21 | // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ 22 | // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ 23 | // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ 24 | /* Modules */ 25 | "module": "commonjs", /* Specify what module code is generated. */ 26 | "rootDir": "./src", /* Specify the root folder within your source files. */ 27 | // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ 28 | // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ 29 | // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ 30 | // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ 31 | // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ 32 | // "types": [], /* Specify type package names to be included without being referenced in a source file. */ 33 | // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ 34 | // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ 35 | // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ 36 | // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ 37 | // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ 38 | // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ 39 | // "resolveJsonModule": true, /* Enable importing .json files. */ 40 | // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ 41 | // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ 42 | /* JavaScript Support */ 43 | // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ 44 | // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ 45 | // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ 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 | // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ 52 | // "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. */ 53 | "outDir": "./build", /* Specify an output folder for all emitted files. */ 54 | // "removeComments": true, /* Disable emitting comments. */ 55 | // "noEmit": true, /* Disable emitting files from a compilation. */ 56 | // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ 57 | // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ 58 | // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ 59 | // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ 60 | // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ 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 | /* Interop Constraints */ 71 | // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ 72 | // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ 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 | /* Type Checking */ 78 | "strict": true, /* Enable all strict type-checking options. */ 79 | // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ 80 | // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ 81 | // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ 82 | // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ 83 | "strictPropertyInitialization": false, /* Check for class properties that are declared but not set in the constructor. */ 84 | // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ 85 | // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ 86 | // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ 87 | // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ 88 | // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ 89 | // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ 90 | // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ 91 | // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ 92 | // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ 93 | // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ 94 | // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ 95 | // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ 96 | // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ 97 | /* Completeness */ 98 | // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ 99 | "skipLibCheck": true /* Skip type checking all .d.ts files. */ 100 | } 101 | } --------------------------------------------------------------------------------