diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c184d2e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +*.lock +.env +migrations/ \ No newline at end of file diff --git a/README.md b/README.md index f36cc9af..8b6b19a4 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,25 @@ -# **TESTE DE BACKEND** +# Instalação -## SITUAÇÃO-PROBLEMA +## Alterar nome de example.env para .env e atualizar o conteúdo com os dados do seu banco: -Você acabou de ser contratado para uma vaga de desenvolvedor backend de uma empresa que revende cervejas do mundo inteiro. O desenvolvedor anterior corrompeu completamente o banco de dados e a API anterior e sobrou apenas um arquivo .JSON com todas as informações do banco. Seu líder confiou a tarefa de recriar a API e o banco de dados a você. +```code +DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=public" +``` -Neste teste, você deverá criar uma API com endpoints a serem consumidos via REST e um banco de dados, utilizando os dados fornecidos no arquivo. ````db.json````. +## Instalar dependências ---------------------------------------------------------------------- +``` +npm install +``` -## REQUISITOS OBRIGATÓRIOS: +## Fazer a migração para o banco de dados Postgresql -- Seja original, projetos suspeitos de serem copiados serão descartados. -- Queremos ver o seu código, e não o de outros. -- Criar coleção no Postman (seu teste será testado por aqui). +``` +npx prisma migrate dev +``` -## GIT - -- Faça um fork deste repositório. -- Crie uma branch para codar as suas features. -- Faça um pull-request quando o teste for finalizado. - -##### **NOTA: Será avaliado também se o nome da branch, títulos de commit, push e comentários possuem boa legibilidade.** - ------------------------------------------------------ - -## FRAMEWORK - - -- Servidor: Express (Javascript/Typescript) ***OU*** Gin (Golang) -- Banco de dados: MongoDB, DynamoDB, MySQL, Postgres... - ------------------------------------------------------ - -## PROJETO - -- Api deve conter pelo menos 1 endpoint para cada operação crud (Create, Read, Update, Delete). -- Um endpoint para listagem de conteúdo. -- Banco de dados a escolha do dev. - -------------------------------------------------------- - -## REQUISITOS DIFERENCIAIS: - -- Seguir os princípios de SOLID. -- Fazer o teste em GoLang. -- Codar um código performático. -- Utilizar inglês no projeto todo. -- Utilizar Injeção de dependências. -- Criar um frontend que consuma a API -- Fazer deploy do mesmo (heroku, aws, google cloud ou outro da preferência). - - - ---- - -## ENTREGA - -- Faça um pull request e nomeie-o como no ex.: Teste de (Seu nome aqui). -- Envie um email para schmidt@repenso.eco e kevin@repenso.eco com o link do pull request, do deploy (tanto do front quanto do back se feito), e anexe a coleção do postman. -- Assim que avaliarmos seu teste, enviaremos uma devolutiva de sucesso ou falha, e caso seja aprovado, um link para agendar sua entrevista técnica. +## Rodar a API na porta 3000 +``` +npm start +``` diff --git a/package.json b/package.json new file mode 100644 index 00000000..611acd19 --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "backend-orma", + "version": "1.0.0", + "main": "src/server.ts", + "repository": "https://github.com/K0dax/backend-test-two.git", + "author": "K0dax ", + "license": "MIT", + "scripts": { + "start": "ts-node-dev src/server.ts" + }, + "dependencies": { + "@prisma/client": "^4.9.0", + "dotenv": "^16.0.3", + "express": "^4.18.2", + "express-async-errors": "^3.1.1", + "prisma": "^4.9.0" + }, + "devDependencies": { + "@types/express": "^4.17.17", + "ts-node-dev": "^2.0.0", + "typescript": "^4.9.5" + } +} diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 00000000..f3bd9d68 --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,30 @@ +// This is your Prisma schema file, +// learn more about it in the docs: https://pris.ly/d/prisma-schema + +generator client { + provider = "prisma-client-js" +} + +datasource db { + provider = "postgresql" + url = env("DATABASE_URL") +} + +model Client{ + id String @id @default(uuid()) + abv Float + address String + category String + city String + lat Float + long Float + country String + description String + ibu Int + name String + state String + website String + + @@map("clients") +} + diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 00000000..11ddd8db --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Keep environment variables out of version control +.env diff --git a/src/controllers/AllClientsController.ts.ts b/src/controllers/AllClientsController.ts.ts new file mode 100644 index 00000000..cd545db1 --- /dev/null +++ b/src/controllers/AllClientsController.ts.ts @@ -0,0 +1,12 @@ +import { Request, Response } from "express"; +import { AllClientsService } from "../services/AllClientsService"; + +export class AllClientsController { + async handle(req: Request, res: Response) { + const allClientsService = await new AllClientsService(); + + const clients = await allClientsService.execute(); + + return res.json(clients); + } +} diff --git a/src/controllers/CreateClientController.ts b/src/controllers/CreateClientController.ts new file mode 100644 index 00000000..91ee52fe --- /dev/null +++ b/src/controllers/CreateClientController.ts @@ -0,0 +1,52 @@ +import { Request, Response } from "express"; +import { CreateClientService } from "../services/CreateClientService"; + +export class CreateClientController { + async handle(req: Request, res: Response) { + const { + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + } = req.body; + + if (!category) { + category == ""; + } + + if (!description) { + description == ""; + } + + if (!website) { + website == ""; + } + + const createClientService = new CreateClientService(); + + const client = await createClientService.execute({ + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + }); + + return res.json(client); + } +} diff --git a/src/controllers/DeleteClientController.ts b/src/controllers/DeleteClientController.ts new file mode 100644 index 00000000..b61f9715 --- /dev/null +++ b/src/controllers/DeleteClientController.ts @@ -0,0 +1,16 @@ +import { Request, Response } from "express"; +import { DeleteClientService } from "../services/DeleteClientService"; + +interface ClientRequest { + id: string; +} +export class DeleteClientController { + async handle(req: Request, res: Response) { + const { id } = req.query; + const deleteClientService = await new DeleteClientService(); + + const client = await deleteClientService.execute({ id } as ClientRequest); + + res.json(client); + } +} diff --git a/src/controllers/DetailsClientController.ts b/src/controllers/DetailsClientController.ts new file mode 100644 index 00000000..5f60888c --- /dev/null +++ b/src/controllers/DetailsClientController.ts @@ -0,0 +1,14 @@ +import { Request, Response } from "express"; +import { DetailsClientService } from "../services/DetailsClientService"; + +export class DetailsClientController { + async handle(req: Request, res: Response) { + const { id } = req.body; + + const detailsClientService = new DetailsClientService(); + + const client = await detailsClientService.execute(id); + + return res.json(client); + } +} diff --git a/src/controllers/GetFilteredClientsController.ts b/src/controllers/GetFilteredClientsController.ts new file mode 100644 index 00000000..1cfc926b --- /dev/null +++ b/src/controllers/GetFilteredClientsController.ts @@ -0,0 +1,51 @@ +import { Request, Response } from "express"; +import { GetFilteredClientsService } from "../services/GetFilteredClientsService"; + +interface ClientRequest { + abv?: number; + address?: string; + category?: string; + city?: string; + lat?: number; + long?: number; + country?: string; + description?: string; + ibu?: number; + name?: string; + state?: string; + website?: string; +} + +export class GetFilteredClientsController { + async handle(req: Request, res: Response) { + const { + abv, + address, + category, + city, + country, + description, + ibu, + name, + state, + website, + } = req.query; + + const getFilteredClientsService = await new GetFilteredClientsService(); + + const clients = await getFilteredClientsService.execute({ + abv, + address, + category, + city, + country, + description, + ibu, + name, + state, + website, + } as ClientRequest); + + res.json(clients); + } +} diff --git a/src/controllers/UpdateClientController.ts b/src/controllers/UpdateClientController.ts new file mode 100644 index 00000000..10dcc15c --- /dev/null +++ b/src/controllers/UpdateClientController.ts @@ -0,0 +1,57 @@ +import { Request, Response } from "express"; +import { UpdateClientService } from "../services/UpdateClientService"; + +interface ClientRequest { + id: string; + abv?: number; + address?: string; + category?: string; + city?: string; + lat?: number; + long?: number; + country?: string; + description?: string; + ibu?: number; + name?: string; + state?: string; + website?: string; +} +export class UpdateClientController { + async handle(req: Request, res: Response) { + const { id } = req.query; + const { + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + } = req.body; + + const updateClientService = await new UpdateClientService(); + + const client = await updateClientService.execute({ + id, + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + } as ClientRequest); + + res.json(client); + } +} diff --git a/src/helpers/CoordinatesClient.ts b/src/helpers/CoordinatesClient.ts new file mode 100644 index 00000000..6e9484a0 --- /dev/null +++ b/src/helpers/CoordinatesClient.ts @@ -0,0 +1,31 @@ +interface IClient { + abv: number; + address: string; + category: string; + city: string; + lat: number; + long: number; + country: string; + description: string; + ibu: number; + name: string; + state: string; + website: string; +} + +export function Coord(client: IClient) { + const clientCoord = { + abv: client.abv, + address: client.address, + category: client.category, + city: client.city, + coordinates: [client.lat, client.long], + country: client.country, + description: client.description, + ibu: client.ibu, + name: client.name, + state: client.state, + website: client.website, + }; + return clientCoord; +} diff --git a/src/helpers/RemoveEmpty.ts b/src/helpers/RemoveEmpty.ts new file mode 100644 index 00000000..e8a81fd7 --- /dev/null +++ b/src/helpers/RemoveEmpty.ts @@ -0,0 +1,3 @@ +export function removeEmpty(client: object) { + return Object.fromEntries(Object.entries(client).filter(([_, v]) => v != "")); +} diff --git a/src/prisma.ts b/src/prisma.ts new file mode 100644 index 00000000..11bbdfef --- /dev/null +++ b/src/prisma.ts @@ -0,0 +1,3 @@ +import { PrismaClient } from "@prisma/client"; + +export const prismaClient = new PrismaClient(); diff --git a/src/routes.ts b/src/routes.ts new file mode 100644 index 00000000..6f9e1d3c --- /dev/null +++ b/src/routes.ts @@ -0,0 +1,24 @@ +import { Router } from "express"; + +import { CreateClientController } from "./controllers/CreateClientController"; +import { DetailsClientController } from "./controllers/DetailsClientController"; +import { AllClientsController } from "./controllers/AllClientsController.ts"; +import { GetFilteredClientsController } from "./controllers/GetFilteredClientsController"; +import { UpdateClientController } from "./controllers/UpdateClientController"; +import { DeleteClientController } from "./controllers/DeleteClientController"; + +const router = Router(); + +router.post("/client", new CreateClientController().handle); + +router.get("/detail", new DetailsClientController().handle); + +router.get("/clients", new AllClientsController().handle); + +router.get("/filtered", new GetFilteredClientsController().handle); + +router.put("/update", new UpdateClientController().handle); + +router.delete("/remove", new DeleteClientController().handle); + +export { router }; diff --git a/src/server.ts b/src/server.ts new file mode 100644 index 00000000..c4a90ba2 --- /dev/null +++ b/src/server.ts @@ -0,0 +1,18 @@ +import express, { Request, Response, NextFunction } from "express"; +import "express-async-errors"; +import { router } from "./routes"; + +const app = express(); +app.use(express.json()); +app.use(router); + +app.use((err: Error, req: Request, res: Response, next: NextFunction) => { + if (err instanceof Error) { + return res.status(400).json({ error: err.message }); + } + return res + .status(500) + .json({ status: "error", message: "Internal server error" }); +}); + +app.listen(3000, () => console.log("Server is running!")); diff --git a/src/services/AllClientsService.ts b/src/services/AllClientsService.ts new file mode 100644 index 00000000..90a4dfdc --- /dev/null +++ b/src/services/AllClientsService.ts @@ -0,0 +1,38 @@ +import { prismaClient } from "../prisma"; + +export class AllClientsService { + async execute() { + const clients = await prismaClient.client.findMany({ + orderBy: { + name: "asc", + }, + }); + + const clientsArray = [] as Array; + for (let i = 0; i < clients.length; i++) { + const element = clients[i]; + function removeEmpty(element: object) { + let client = Object.fromEntries( + Object.entries(element).filter(([_, v]) => v != "") + ); + let clientCoord = { + abv: client.abv, + address: client.address, + category: client.category, + city: client.city, + coordinates: [client.lat, client.long], + country: client.country, + description: client.description, + ibu: client.ibu, + name: client.name, + state: client.state, + website: client.website, + }; + clientsArray.push(clientCoord); + } + removeEmpty(element); + } + + return clientsArray; + } +} diff --git a/src/services/CreateClientService.ts b/src/services/CreateClientService.ts new file mode 100644 index 00000000..614e63d8 --- /dev/null +++ b/src/services/CreateClientService.ts @@ -0,0 +1,66 @@ +import { prismaClient } from "../prisma"; +import { Coord } from "../helpers/CoordinatesClient"; +import { removeEmpty } from "../helpers/RemoveEmpty"; + +interface ClientRequest { + abv: number; + address: string; + category: string; + city: string; + lat: number; + long: number; + country: string; + description: string; + ibu: number; + name: string; + state: string; + website: string; +} + +export class CreateClientService { + async execute({ + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + }: ClientRequest) { + const clientAlreadyExists = await prismaClient.client.findFirst({ + where: { + lat: lat, + long: long, + }, + }); + + if (clientAlreadyExists) { + throw new Error("These coordinates have been registered before"); + } + + const client = await prismaClient.client.create({ + data: { + abv: abv, + address: address, + category: category, + city: city, + lat: lat, + long: long, + country: country, + description: description, + ibu: ibu, + name: name, + state: state, + website: website, + }, + }); + const clientCoord = Coord(client); + + return removeEmpty(clientCoord); + } +} diff --git a/src/services/DeleteClientService.ts b/src/services/DeleteClientService.ts new file mode 100644 index 00000000..e5ac59e0 --- /dev/null +++ b/src/services/DeleteClientService.ts @@ -0,0 +1,20 @@ +import { prismaClient } from "../prisma"; +import { Coord } from "../helpers/CoordinatesClient"; +import { removeEmpty } from "../helpers/RemoveEmpty"; + +interface ClientRequest { + id: string; +} + +export class DeleteClientService { + async execute({ id }: ClientRequest) { + const client = await prismaClient.client.delete({ + where: { + id: id, + }, + }); + const clientCoord = Coord(client); + + return removeEmpty(clientCoord); + } +} diff --git a/src/services/DetailsClientService.ts b/src/services/DetailsClientService.ts new file mode 100644 index 00000000..ed187c39 --- /dev/null +++ b/src/services/DetailsClientService.ts @@ -0,0 +1,21 @@ +import { prismaClient } from "../prisma"; +import { Coord } from "../helpers/CoordinatesClient"; +import { removeEmpty } from "../helpers/RemoveEmpty"; + +export class DetailsClientService { + async execute(id: string) { + const client = await prismaClient.client.findFirst({ + where: { + id: id, + }, + }); + + if (!client) { + throw new Error("Client not found or not exists!"); + } + + const clientCoord = Coord(client); + + return removeEmpty(clientCoord); + } +} diff --git a/src/services/GetFilteredClientsService.ts b/src/services/GetFilteredClientsService.ts new file mode 100644 index 00000000..c0134585 --- /dev/null +++ b/src/services/GetFilteredClientsService.ts @@ -0,0 +1,70 @@ +import { prismaClient } from "../prisma"; + +interface ClientRequest { + abv?: number; + address?: string; + category?: string; + city?: string; + country?: string; + description?: string; + ibu?: number; + name?: string; + state?: string; + website?: string; +} +export class GetFilteredClientsService { + async execute({ + abv, + address, + category, + city, + country, + description, + ibu, + name, + state, + website, + }: ClientRequest) { + const clients = await prismaClient.client.findMany({ + where: { + abv: abv, + address: address, + category: category, + city: city, + country: country, + description: description, + ibu: ibu, + name: name, + state: state, + website: website, + }, + }); + + const clientsArray = [] as Array; + for (let i = 0; i < clients.length; i++) { + const element = clients[i]; + function removeEmpty(element: object) { + let client = Object.fromEntries( + Object.entries(element).filter(([_, v]) => v != "") + ); + let clientCoord = { + abv: client.abv, + address: client.address, + category: client.category, + city: client.city, + coordinates: [client.lat, client.long], + country: client.country, + description: client.description, + ibu: client.ibu, + name: client.name, + state: client.state, + website: client.website, + }; + clientsArray.push(clientCoord); + } + removeEmpty(element); + } + + return clientsArray; + } +} diff --git a/src/services/UpdateClientService.ts b/src/services/UpdateClientService.ts new file mode 100644 index 00000000..3510039f --- /dev/null +++ b/src/services/UpdateClientService.ts @@ -0,0 +1,60 @@ +import { prismaClient } from "../prisma"; +import { Coord } from "../helpers/CoordinatesClient"; +import { removeEmpty } from "../helpers/RemoveEmpty"; + +interface ClientRequest { + id: string; + abv?: number; + address?: string; + category?: string; + city?: string; + lat?: number; + long?: number; + country?: string; + description?: string; + ibu?: number; + name?: string; + state?: string; + website?: string; +} + +export class UpdateClientService { + async execute({ + id, + abv, + address, + category, + city, + lat, + long, + country, + description, + ibu, + name, + state, + website, + }: ClientRequest) { + const client = await prismaClient.client.update({ + where: { + id: id, + }, + data: { + abv: abv, + address: address, + category: category, + city: city, + lat: lat, + long: long, + country: country, + description: description, + ibu: ibu, + name: name, + state: state, + website: website, + }, + }); + const clientCoord = Coord(client); + + return removeEmpty(clientCoord); + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..be00030a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,103 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "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. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +}