diff --git a/modulo6/rodada-cases-semana4/.gitignore b/modulo6/rodada-cases-semana4/.gitignore new file mode 100644 index 0000000..8ece3ba --- /dev/null +++ b/modulo6/rodada-cases-semana4/.gitignore @@ -0,0 +1,4 @@ +node_modules +package-lock.json +build +.env \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/jest.config.js b/modulo6/rodada-cases-semana4/jest.config.js new file mode 100644 index 0000000..8280b80 --- /dev/null +++ b/modulo6/rodada-cases-semana4/jest.config.js @@ -0,0 +1,8 @@ +module.exports = { + roots: ["/tests"], + transform: { + "^.+\\.tsx?$": "ts-jest", + }, + testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$", + moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], + } \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/package.json b/modulo6/rodada-cases-semana4/package.json new file mode 100644 index 0000000..fa37af3 --- /dev/null +++ b/modulo6/rodada-cases-semana4/package.json @@ -0,0 +1,31 @@ +{ + "name": "rodada-cases-semana4", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "dev": "ts-node-dev ./src/index.ts", + "start": "tsc && node ./build/index.js", + "test": "jest" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@types/cors": "^2.8.12", + "@types/express": "^4.17.13", + "@types/knex": "^0.16.1", + "@types/jest": "^28.1.6", + "ts-node-dev": "^2.0.0", + "typescript": "^4.7.4" + }, + "dependencies": { + "cors": "^2.8.5", + "dotenv": "^16.0.1", + "express": "^4.18.1", + "jest": "^28.1.3", + "knex": "^2.2.0", + "mysql": "^2.18.1", + "ts-jest": "^28.0.7" + } +} diff --git a/modulo6/rodada-cases-semana4/requests.rest b/modulo6/rodada-cases-semana4/requests.rest new file mode 100644 index 0000000..16ce54b --- /dev/null +++ b/modulo6/rodada-cases-semana4/requests.rest @@ -0,0 +1,17 @@ +### PEGAR TODOS OS POKEMON +GET http://localhost:3003/pokemon + +### PEGAR POKEMON POR NOME +GET http://localhost:3003/pokemon/name/:name + +### PEGAR POKEMON POR GERAÇÃO +GET http://localhost:3003/pokemon/generation/0 + +### PEGAR POKEMON PELO NÚMERO DA POKEDEX +GET http://localhost:3003/pokemon/pokedex/0 + +### PEGAR POKEMON PELO PRIMEIRO TIPO +GET http://localhost:3003/pokemon/type1/:type1 + +### PEGAR POKEMON PELO SEGUNDO TIPO +GET http://localhost:3003/pokemon/type2/:type2 \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/app.ts b/modulo6/rodada-cases-semana4/src/app.ts new file mode 100644 index 0000000..78e825d --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/app.ts @@ -0,0 +1,21 @@ +import express, { Express } from 'express' + import cors from 'cors' + import { AddressInfo } from "net" + import dotenv from 'dotenv' + dotenv.config() + + const app: Express = express() + + app.use(express.json()) + app.use(cors()) + + const server = app.listen(process.env.PORT || 3003, () => { + if (server) { + const address = server.address() as AddressInfo; + console.log(`Server is running in http://localhost: ${address.port}`) + } else { + console.error(`Failure upon starting server.`) + } + }) + + export default app \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/business/PokemonBusiness.ts b/modulo6/rodada-cases-semana4/src/business/PokemonBusiness.ts new file mode 100644 index 0000000..02043a8 --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/business/PokemonBusiness.ts @@ -0,0 +1,85 @@ +import { PokemonDatabase } from "../data/PokemonDatabase"; +import { Pokemon } from "../model/Pokemon"; + +export class PokemonBusiness { + constructor( + private pokemonDatabase: PokemonDatabase + ) { } + getAllPokemon = async (page: number): Promise => { + try { + const size = 10 + let offset = (page - 1) * size + if (page < 1 || page > 83) { + throw new Error("Insira um valor válido de 1 a 83") + } else if (page) { + const result = await this.pokemonDatabase.getAllPokemon(size, offset) + return result + } else if (!page) { + const result = await this.pokemonDatabase.getAllPokemon() + return result + } + + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByName = async (name: string): Promise => { + try { + if (!name || name === ":name") { + throw new Error("Insira um nome de pokemon") + } + const pokemonDb = await this.pokemonDatabase.getPokemonByName(name) + return pokemonDb + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByGeneration = async (generation: number): Promise => { + try { + if (!generation || generation === 0) { + throw new Error("Insira uma geração") + } + if (generation > 7) { + throw new Error("Insira um número de 1 a 7") + } + const pokemonDb = await this.pokemonDatabase.getPokemonByGeneration(generation) + return pokemonDb + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + + } + getPokemonByPokedexNumber = async (pokedex_number: number): Promise => { + try { + if (!pokedex_number || pokedex_number === 0) { + throw new Error("Insira um número de pokedex para buscar o pokemon referente") + } + const pokemonDb = await this.pokemonDatabase.getPokemonByPokedexNumber(pokedex_number) + return pokemonDb + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByType1 = async (type1: string): Promise => { + try { + if (!type1 || type1 === ":type1") { + throw new Error("Insira o primeiro tipo do pokemon que deseja buscar") + } + const pokemonDb = await this.pokemonDatabase.getPokemonByType1(type1) + return pokemonDb + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByType2 = async (type2: string): Promise => { + try { + if (!type2 || type2 === ":type2") { + throw new Error("Insira o segundo tipo do pokemon que deseja buscar") + } + const pokemonDb = await this.pokemonDatabase.getPokemonByType2(type2) + return pokemonDb + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/controller/PokemonController.ts b/modulo6/rodada-cases-semana4/src/controller/PokemonController.ts new file mode 100644 index 0000000..014ef0c --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/controller/PokemonController.ts @@ -0,0 +1,63 @@ +import { Request, Response } from "express" +import { PokemonBusiness } from "../business/PokemonBusiness" + +export class PokemonController { + constructor( + private pokemonBusiness: PokemonBusiness + ) { } + getAllPokemon = async (req: Request, res: Response) => { + try { + let page = Number(req.query.page) + const result = await this.pokemonBusiness.getAllPokemon(page) + res.status(200).send(result) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } + getPokemonByName = async (req: Request, res: Response) => { + try { + const { name } = req.params + const pokemon = await this.pokemonBusiness.getPokemonByName(name) + res.status(200).send(pokemon) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } + getPokemonByGeneration = async (req: Request, res: Response) => { + try { + const generation = Number(req.params.generation) + const pokemon = await this.pokemonBusiness.getPokemonByGeneration(generation) + res.status(200).send(pokemon) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } + getPokemonByPokedexNumber = async (req: Request, res: Response) => { + try { + const pokedex_number = Number(req.params.pokedex_number) + const pokemon = await this.pokemonBusiness.getPokemonByPokedexNumber(pokedex_number) + res.status(200).send(pokemon) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } + getPokemonByType1 = async (req: Request, res: Response) => { + try { + const { type1 } = req.params + + const pokemon = await this.pokemonBusiness.getPokemonByType1(type1) + res.status(200).send(pokemon) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } + getPokemonByType2 = async (req: Request, res: Response) => { + try { + const { type2 } = req.params + const pokemon = await this.pokemonBusiness.getPokemonByType2(type2) + res.status(200).send(pokemon) + } catch (error: any) { + res.status(500).send({ message: error.message }) + } + } +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/data/BaseDatabase.ts b/modulo6/rodada-cases-semana4/src/data/BaseDatabase.ts new file mode 100644 index 0000000..fd8d493 --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/data/BaseDatabase.ts @@ -0,0 +1,16 @@ +import knex, {Knex} from "knex" + import dotenv from "dotenv" + dotenv.config() + + export class BaseDatabase { + protected static connection: Knex = knex({ + client: "mysql", + connection: { + host: process.env.DB_HOST, + port: 3306, + user: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_NAME + } + }) + } \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/data/PokemonDatabase.ts b/modulo6/rodada-cases-semana4/src/data/PokemonDatabase.ts new file mode 100644 index 0000000..59e44d7 --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/data/PokemonDatabase.ts @@ -0,0 +1,68 @@ +import { Pokemon } from "../model/Pokemon" +import { BaseDatabase } from "./BaseDatabase" + +export class PokemonDatabase extends BaseDatabase { + protected TABLE_NAME = 'mytable' + + getAllPokemon = async (size?: any, offset?: any): Promise => { + try { + const result = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .limit(size) + .offset(offset) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByName = async (name: string): Promise => { + try { + const [result] = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .where({ name }) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByGeneration = async (generation: number) => { + try { + const result: Pokemon[] = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .where({ generation }) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByPokedexNumber = async (pokedex_number: number) => { + try { + const result: Pokemon[] = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .where({ pokedex_number }) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByType1 = async (type1: string) => { + try { + const result: Pokemon[] = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .where({ type1 }) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } + getPokemonByType2 = async (type2: string) => { + try { + const result: Pokemon[] = await BaseDatabase.connection(this.TABLE_NAME) + .select("*") + .where({ type2 }) + return result + } catch (error: any) { + throw new Error(error.sqlMessage || error.message) + } + } +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/error/CustomError.ts b/modulo6/rodada-cases-semana4/src/error/CustomError.ts new file mode 100644 index 0000000..23e3882 --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/error/CustomError.ts @@ -0,0 +1,5 @@ +export class CustomError extends Error { + constructor(public code: number, public message: string) { + super(message) + } +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/index.ts b/modulo6/rodada-cases-semana4/src/index.ts new file mode 100644 index 0000000..2a1b95a --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/index.ts @@ -0,0 +1,17 @@ +import app from "./app" +import { PokemonBusiness } from "./business/PokemonBusiness" +import { PokemonController } from "./controller/PokemonController" +import { PokemonDatabase } from "./data/PokemonDatabase" + +const pokemonController = new PokemonController( + new PokemonBusiness( + new PokemonDatabase + ) +) + +app.get("/pokemon", pokemonController.getAllPokemon) +app.get("/pokemon/name/:name", pokemonController.getPokemonByName) +app.get("/pokemon/generation/:generation", pokemonController.getPokemonByGeneration) +app.get("/pokemon/pokedex/:pokedex_number", pokemonController.getPokemonByPokedexNumber) +app.get("/pokemon/type1/:type1", pokemonController.getPokemonByType1) +app.get("/pokemon/type2/:type2", pokemonController.getPokemonByType2) \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/src/model/Pokemon.ts b/modulo6/rodada-cases-semana4/src/model/Pokemon.ts new file mode 100644 index 0000000..54aebed --- /dev/null +++ b/modulo6/rodada-cases-semana4/src/model/Pokemon.ts @@ -0,0 +1,32 @@ +export interface Pokemon { + id: number, + name: string, + pokedex_number: number, + img_name: string, + generation: number, + evolution_stage: string | null, + evolved: number, + family_id: number | null, + cross_gen: number, + type1: string, + type2: string | null, + weather1: string, + weather2: string | null, + stat_total: number, + atk: number, + def: number, + sta: number, + legendary: number, + aquireable: number, + spawns: number, + regional: number, + raidable: number, + hatchable: number, + shiny: number, + nest: number, + new: number, + not_gettable: number, + future_evolve: number, + full_cp_at_forty: number, + full_cp_at_thirty_nine: number +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/tests/index.test.ts b/modulo6/rodada-cases-semana4/tests/index.test.ts new file mode 100644 index 0000000..98003fd --- /dev/null +++ b/modulo6/rodada-cases-semana4/tests/index.test.ts @@ -0,0 +1,104 @@ +import { PokemonBusiness } from "../src/business/PokemonBusiness" +import { PokemonDatabaseMock } from "./mocks/PokemonDatabaseMock" +import { pokemon1, pokemon2 } from "./mocks/PokemonMock" + +const pokemonBusinessMock = new PokemonBusiness( + new PokemonDatabaseMock as any +) + +describe("tests of pokemon table", () => { + test("getAllPokemon, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getAllPokemon(1) + expect(result).toStrictEqual([pokemon1, pokemon2]) + } catch (error: any) { + console.log(error) + } + }) + test("getPokemonByName, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getPokemonByName("Paçoca") + expect(result).toBe(pokemon1) + } catch (error: any) { + console.log(error) + } + }) + test("getPokemonByName, empty name parameter", async () => { + expect.assertions(1) + try { + await pokemonBusinessMock.getPokemonByName("") + } catch (error: any) { + expect(error.message).toBe("Insira um nome de pokemon") + } + }) + test("getPokemonByGeneration, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getPokemonByGeneration(5) + expect(result).toBe(pokemon2) + } catch (error: any) { + console.log(error.message) + } + }) + test("getPokemonByGeneration, empty generation parameter", async () => { + expect.assertions(1) + try { + await pokemonBusinessMock.getPokemonByGeneration(0) + } catch (error: any) { + expect(error.message).toBe("Insira uma geração") + } + }) + test("getPokemonByPokedexNumber, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getPokemonByPokedexNumber(823) + expect(result).toBe(pokemon1) + } catch (error: any) { + console.log(error.message) + } + }) + test("getPokemonByPokedexNumber, empty pokedex_number parameter", async () => { + expect.assertions(1) + try { + await pokemonBusinessMock.getPokemonByPokedexNumber(0) + } catch (error: any) { + expect(error.message).toBe("Insira um número de pokedex para buscar o pokemon referente") + } + }) + test("getPokemonByType1, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getPokemonByType1("poison") + expect(result).toBe(pokemon2) + } catch (error: any) { + console.log(error.message) + } + }) + test("getPokemonByType1, empty type1 parameter", async () => { + expect.assertions(1) + try { + await pokemonBusinessMock.getPokemonByType1("") + } catch (error: any) { + expect(error.message).toBe("Insira o primeiro tipo do pokemon que deseja buscar") + } + }) + test("getPokemonByType2, sucess", async () => { + expect.assertions(1) + try { + const result = await pokemonBusinessMock.getPokemonByType2("grass") + expect(result).toBe(pokemon2) + } catch (error: any) { + console.log(error.message) + } + }) + test("getPokemonByType1, empty type2 parameter", async () => { + expect.assertions(1) + try { + await pokemonBusinessMock.getPokemonByType2("") + } catch (error: any) { + expect(error.message).toBe("Insira o segundo tipo do pokemon que deseja buscar") + } + }) +}) \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/tests/mocks/PokemonDatabaseMock.ts b/modulo6/rodada-cases-semana4/tests/mocks/PokemonDatabaseMock.ts new file mode 100644 index 0000000..8381de6 --- /dev/null +++ b/modulo6/rodada-cases-semana4/tests/mocks/PokemonDatabaseMock.ts @@ -0,0 +1,61 @@ +import { Pokemon } from "../../src/model/Pokemon" +import { pokemon1, pokemon2 } from './PokemonMock' + +export class PokemonDatabaseMock { + + getAllPokemon = async (size?: any, offset?: any): Promise => { + return [pokemon1, pokemon2] + } + + getPokemonByName = async (name: string): Promise => { + switch (name) { + case "Paçoca": + return pokemon1 + case "Pipoca": + return pokemon2 + default: + return undefined + + } + } + getPokemonByGeneration = async (generation: number): Promise => { + switch (generation) { + case 7: + return pokemon1 + case 5: + return pokemon2 + default: + return undefined + } + } + getPokemonByPokedexNumber = async (pokedex_number: number): Promise => { + switch (pokedex_number) { + case 823: + return pokemon1 + case 824: + return pokemon2 + default: + return undefined + } + } + getPokemonByType1 = async (type1: string): Promise => { + switch (type1) { + case "grass": + return pokemon1 + case "poison": + return pokemon2 + default: + return undefined + } + } + getPokemonByType2 = async (type2: string): Promise => { + switch (type2) { + case "poison": + return pokemon1 + case "grass": + return pokemon2 + default: + return undefined + } + } +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/tests/mocks/PokemonMock.ts b/modulo6/rodada-cases-semana4/tests/mocks/PokemonMock.ts new file mode 100644 index 0000000..4aa78f7 --- /dev/null +++ b/modulo6/rodada-cases-semana4/tests/mocks/PokemonMock.ts @@ -0,0 +1,67 @@ +import { Pokemon } from "../../src/model/Pokemon"; + +export const pokemon1: Pokemon = { + id: 823, + name: "Paçoca", + pokedex_number: 823, + img_name: "823", + generation: 7, + evolution_stage: "2", + evolved: 0, + family_id: 1, + cross_gen: 0, + type1: "grass", + type2: "poison", + weather1: "Sunny/clear", + weather2: "Cloudy", + stat_total: 422, + atk: 151, + def: 151, + sta: 120, + legendary: 0, + aquireable: 1, + spawns: 1, + regional: 0, + raidable: 0, + hatchable: 0, + shiny: 0, + nest: 0, + new: 0, + not_gettable: 0, + future_evolve: 0, + full_cp_at_forty: 1552, + full_cp_at_thirty_nine: 1529 +} + +export const pokemon2: Pokemon = { + id: 824, + name: "Pipoca", + pokedex_number: 824, + img_name: "824", + generation: 5, + evolution_stage: "2", + evolved: 0, + family_id: 1, + cross_gen: 0, + type1: "poison", + type2: "grass", + weather1: "Cloudy", + weather2: "Sunny/clear", + stat_total: 421, + atk: 153, + def: 150, + sta: 120, + legendary: 0, + aquireable: 1, + spawns: 1, + regional: 0, + raidable: 0, + hatchable: 0, + shiny: 0, + nest: 0, + new: 0, + not_gettable: 0, + future_evolve: 0, + full_cp_at_forty: 1529, + full_cp_at_thirty_nine: 1552 +} \ No newline at end of file diff --git a/modulo6/rodada-cases-semana4/tsconfig.json b/modulo6/rodada-cases-semana4/tsconfig.json new file mode 100644 index 0000000..2038bf2 --- /dev/null +++ b/modulo6/rodada-cases-semana4/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": "es6", /* 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": "./build", /* 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. */ + } +}