Skip to content

Commit 332205f

Browse files
authoredAug 5, 2022
Merge pull request #1 from ncdcdev/method
Method
2 parents f06cb3e + d6e7cf0 commit 332205f

17 files changed

+2841
-1
lines changed
 

‎.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
volumes
2+
13
# Logs
24
logs
35
*.log

‎README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,24 @@ yarn
1515
起動
1616
```
1717
yarn start
18-
```
18+
```
19+
20+
2. method
21+
インストール
22+
```
23+
cd samples/method
24+
yarn
25+
```
26+
27+
DB起動
28+
```
29+
// samplesディレクトリに移動
30+
cd ../
31+
docker-compose up -d
32+
```
33+
34+
起動
35+
```
36+
cd samples/method
37+
yarn start
38+
```

‎samples/docker-compose.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use root/example as user/password credentials
2+
version: '3.1'
3+
4+
services:
5+
6+
db:
7+
image: mysql
8+
command: --default-authentication-plugin=mysql_native_password
9+
restart: always
10+
ports:
11+
- 13306:3306
12+
volumes:
13+
- ./volumes/example_db/db/data:/var/lib/mysql
14+
- ./volumes/example_db/db/my.cnf:/etc/mysql/conf.d/my.cnf
15+
environment:
16+
MYSQL_DATABASE: example_db
17+
MYSQL_ROOT_PASSWORD: example
18+
MYSQL_USER: docker
19+
MYSQL_PASSWORD: docker
20+
21+
adminer:
22+
image: adminer
23+
restart: always
24+
ports:
25+
- 8080:8080

‎samples/hello-world/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import express from 'express'
2+
import "reflect-metadata"
23

34
const app: express.Express = express()
45

‎samples/method/.eslintrc.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
},
6+
extends: [
7+
'airbnb-base',
8+
'prettier',
9+
],
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
ecmaVersion: 'latest',
13+
sourceType: 'module',
14+
},
15+
plugins: [
16+
'@typescript-eslint',
17+
],
18+
rules: {
19+
},
20+
};

‎samples/method/.prettierrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
singleQuote: true,
3+
trailingComma: 'es5',
4+
printWidth: 100,
5+
semi: false,
6+
}

‎samples/method/data-source.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { DataSource } from "typeorm";
2+
3+
const AppDataSource = new DataSource({
4+
type: "mysql",
5+
host: "localhost",
6+
port: 13306,
7+
username: "docker",
8+
password: "docker",
9+
database: "example_db",
10+
synchronize: false,
11+
logging: true,
12+
entities: ["src/entities/**/*.ts"],
13+
migrations: ["src/migrations/**/*.ts"],
14+
})
15+
16+
export default AppDataSource
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
openapi: 3.0.0
2+
x-stoplight:
3+
id: 70he5bttrcegx
4+
info:
5+
title: tutorial-api
6+
version: '1.0'
7+
servers:
8+
- url: 'http://localhost:3000'
9+
paths:
10+
/contents:
11+
post:
12+
summary: Create New Content
13+
operationId: post-content
14+
responses:
15+
'200':
16+
description: Content Created
17+
content:
18+
application/json:
19+
schema:
20+
type: array
21+
items:
22+
$ref: '#/components/schemas/Content'
23+
examples: {}
24+
requestBody:
25+
content:
26+
application/json:
27+
schema:
28+
$ref: '#/components/schemas/PostContentRequest'
29+
examples: {}
30+
description: Post the necessary fields for the API to create a new content.
31+
description: Create a new content.
32+
parameters: []
33+
get:
34+
summary: Get Contents
35+
operationId: get-contents
36+
responses:
37+
'200':
38+
description: OK
39+
content:
40+
application/json:
41+
schema:
42+
type: array
43+
items:
44+
$ref: '#/components/schemas/Content'
45+
tags:
46+
- Content
47+
'/contents/{contentId}':
48+
parameters:
49+
- schema:
50+
type: string
51+
name: contentId
52+
in: path
53+
required: true
54+
get:
55+
summary: Get Content Info by Content ID
56+
tags:
57+
- Content
58+
responses:
59+
'200':
60+
description: Content Found
61+
content:
62+
application/json:
63+
schema:
64+
$ref: '#/components/schemas/Content'
65+
examples:
66+
Get Content Alice Smith:
67+
value:
68+
id: 142
69+
firstName: Alice
70+
lastName: Smith
71+
email: alice.smith@gmail.com
72+
dateOfBirth: '1997-10-31'
73+
emailVerified: true
74+
signUpDate: '2019-08-24'
75+
operationId: get-contents-contentId
76+
description: Retrieve the information of the content with the matching content ID.
77+
delete:
78+
summary: Delete a Content by Content ID
79+
operationId: delete-contents-contentsId
80+
responses:
81+
'204':
82+
description: No Content
83+
tags:
84+
- Content
85+
put:
86+
summary: Update a Content
87+
operationId: put-contents-contentsId
88+
responses:
89+
'200':
90+
description: OK
91+
content:
92+
application/json:
93+
schema:
94+
$ref: '#/components/schemas/Content'
95+
tags:
96+
- Content
97+
requestBody:
98+
content:
99+
application/json:
100+
schema:
101+
$ref: '#/components/schemas/PostContentRequest'
102+
description: 一部のパラメータのみの更新も可能とする
103+
components:
104+
schemas:
105+
Content:
106+
title: Content
107+
type: object
108+
description: ''
109+
x-examples:
110+
Alice Smith:
111+
id: 142
112+
firstName: Alice
113+
lastName: Smith
114+
email: alice.smith@gmail.com
115+
dateOfBirth: '1997-10-31'
116+
emailVerified: true
117+
signUpDate: '2019-08-24'
118+
properties:
119+
id:
120+
type: integer
121+
description: Unique identifier for the given content.
122+
title:
123+
type: string
124+
body:
125+
type: string
126+
createdAt:
127+
type: string
128+
format: date
129+
description: The date that the content was created.
130+
updatedAt:
131+
type: string
132+
required:
133+
- id
134+
- title
135+
- body
136+
PostContentRequest:
137+
title: PostContentRequest
138+
x-stoplight:
139+
id: uyyane08s9ozp
140+
type: object
141+
properties:
142+
title:
143+
type: string
144+
body:
145+
type: string
146+
requestBodies: {}

‎samples/method/nodemon.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"watch": [
3+
"src"
4+
],
5+
"ext": "ts",
6+
"exec": "ts-node -r tsconfig-paths/register ./src/index.ts"
7+
}

‎samples/method/package.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "hello-world",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"dev": "./node_modules/.bin/nodemon",
8+
"start": "ts-node src/index.ts",
9+
"lint": "eslint --fix './src/**/*.{js,jsx,ts,tsx}'",
10+
"format": "prettier --write ./src",
11+
"make:migration": "typeorm-ts-node-commonjs migration:generate ./src/migrations -d ./data-source.ts",
12+
"migrate": "typeorm-ts-node-commonjs migration:run -d ./data-source.ts",
13+
"rollback": "typeorm-ts-node-commonjs migration:revert -d ./data-source.ts"
14+
},
15+
"dependencies": {
16+
"@typescript-eslint/eslint-plugin": "^5.32.0",
17+
"@typescript-eslint/parser": "^5.32.0",
18+
"eslint": "^7.32.0 || ^8.2.0",
19+
"express": "^4.18.1",
20+
"nodemon": "^2.0.19",
21+
"reflect-metadata": "^0.1.13",
22+
"typeorm": "^0.3.7"
23+
},
24+
"devDependencies": {
25+
"@types/express": "^4.17.13",
26+
"@types/node": "^18.6.4",
27+
"eslint-config-airbnb-base": "^15.0.0",
28+
"eslint-config-prettier": "^8.5.0",
29+
"eslint-plugin-import": "^2.25.2",
30+
"prettier": "^2.7.1",
31+
"ts-node": "^10.9.1",
32+
"typescript": "^4.7.4"
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE TABLE `content` (
2+
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
3+
title VARCHAR(256),
4+
body VARCHAR(1024)) ENGINE = InnoDB;

‎samples/method/src/constants.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const contents = [
2+
{
3+
id: 1,
4+
title: '坊っちゃん',
5+
body: '親譲りの無鉄砲で小供の時から損ばかりしている。小学校に居る時分学校の二階から飛び降りて一週間ほど腰を抜かした事がある。なぜそんな無闇をしたと聞く人があるかも知れぬ。別段深い理由でもない。新築の二階から首を出していたら、同級生の一人が冗談に、いくら威張っても、そこから飛び降りる事は出来まい。弱虫やーい。と囃したからである。小使に負ぶさって帰って来た時、おやじが大きな眼をして二階ぐらいから飛び降りて腰を抜かす奴があるかと云ったから、この次は抜かさずに飛んで見せますと答えた。\n\n親譲りの無鉄砲で小供の時から損ばかりしている。小学校に居る時分学校の二階から飛び降りて一週間ほど腰を抜かした事がある。なぜそんな無闇をしたと聞く人があるかも知れぬ。別段深い理由でもない。新築の二階から首を出していたら、同級生の一人が冗談に、いくら威張っても、そこから飛び降りる事は出来まい。弱虫やーい。と囃したからである。小使に負ぶさって帰って来た時、おやじが大きな眼をして二階ぐらいから飛び降りて腰を抜かす奴があるかと云ったから、この次は抜かさずに飛んで見せますと答えた。',
6+
createdAt: new Date(),
7+
updatedAt: new Date(),
8+
},
9+
{
10+
id: 2,
11+
title: '方丈記',
12+
body: '行く川のながれは絶えずして、しかも本の水にあらず。よどみに浮ぶうたかたは、かつ消えかつ結びて久しくとゞまることなし。世の中にある人とすみかと、またかくの如し。玉しきの都の中にむねをならべいらかをあらそへる、たかきいやしき人のすまひは、代々を經て盡きせぬものなれど、これをまことかと尋ぬれば、昔ありし家はまれなり。或はこぞ破れ(やけイ)てことしは造り、あるは大家ほろびて小家となる。住む人もこれにおなじ。所もかはらず、人も多かれど、いにしへ見し人は、二三十人が中に、わづかにひとりふたりなり。あしたに死し、ゆふべに生るゝならひ、たゞ水の泡にぞ似たりける。知らず、生れ死ぬる人、いづかたより來りて、いづかたへか去る。又知らず、かりのやどり、誰が爲に心を惱まし、何によりてか目をよろこばしむる。そのあるじとすみかと、無常をあらそひ去るさま、いはゞ朝顏の露にことならず。或は露おちて花のこれり。のこるといへども朝日に枯れぬ。或は花はしぼみて、露なほ消えず。消えずといへども、ゆふべを待つことなし。』およそ物の心を知れりしよりこのかた、四十あまりの春秋をおくれる間に、世のふしぎを見ることやゝたびたびになりぬ。いにし安元三年四月廿八日かとよ、風烈しく吹きてしづかならざりし夜、戌の時ばかり、都のたつみより火出で來りていぬゐに至る。はてには朱雀門、大極殿、大學寮、民部の省まで移りて、ひとよがほどに、塵灰となりにき。火本は樋口富の小路とかや、病人を宿せるかりやより出で來けるとなむ。吹きまよふ風にとかく移り行くほどに、扇をひろげたるが如くすゑひろになりぬ。遠き家は煙にむせび、近きあたりはひたすらほのほを地に吹きつけたり。空には灰を吹きたてたれば、火の光に映じてあまねくくれなゐなる中に、風に堪へず吹き切られたるほのほ、飛ぶが如くにして一二町を越えつゝ移り行く。その中の人うつゝ(しイ)心ならむや。あるひは煙にむせびてたふれ伏し、或は炎にまぐれてたちまちに死しぬ。或は又わづかに身一つからくして遁れたれども、資財を取り出づるに及ばず。七珍萬寳、さながら灰燼となりにき。そのつひえいくそばくぞ。このたび公卿の家十六燒けたり。ましてその外は數を知らず。すべて都のうち、三分が二(一イ)に及べりとぞ。男女死ぬるもの數千人、馬牛のたぐひ邊際を知らず。人のいとなみみなおろかなる中に、さしも危き京中の家を作るとて寶をつひやし心をなやますことは、すぐれてあぢきなくぞ侍るべき。』また治承四年卯月廿九日のころ、中の御門京極のほどより、大なるつじかぜ起りて、六條わたりまで、いかめしく吹きけること侍りき。三四町をかけて吹きまくるに、その中にこもれる家ども、大なるもちひさきも、一つとしてやぶれざるはなし。さながらひらにたふれたるもあり。',
13+
createdAt: new Date(),
14+
updatedAt: new Date(),
15+
},
16+
]
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm'
2+
3+
@Entity()
4+
export class Content {
5+
@PrimaryGeneratedColumn()
6+
id!: number
7+
8+
@Column('varchar')
9+
title: string
10+
11+
@Column('varchar')
12+
body: string
13+
14+
constructor(title: string, body: string) {
15+
this.title = title
16+
this.body = body
17+
}
18+
}

‎samples/method/src/index.ts

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import express from 'express'
2+
import AppDataSource from '../data-source'
3+
import { Content } from './entities/Content'
4+
5+
const app: express.Express = express()
6+
7+
// CORSの許可
8+
app.use((req, res, next) => {
9+
res.header('Access-Control-Allow-Origin', '*')
10+
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
11+
next()
12+
})
13+
14+
// body-parserに基づいた着信リクエストの解析
15+
app.use(express.json())
16+
app.use(express.urlencoded({ extended: true }))
17+
18+
AppDataSource.initialize()
19+
20+
const router: express.Router = express.Router()
21+
22+
const repository = AppDataSource.getRepository(Content)
23+
24+
// GET /contents
25+
router.get('/contents', async (req: express.Request, res: express.Response) => {
26+
try {
27+
const contents = await repository.find()
28+
res.send(contents)
29+
} catch (error) {
30+
console.error(error)
31+
res.status(500).send(error)
32+
}
33+
})
34+
35+
// POST /contents
36+
router.post('/contents', async (req: express.Request, res: express.Response) => {
37+
try {
38+
const content = new Content(req.body.title, req.body.body)
39+
await repository.save(content)
40+
res.send(content)
41+
} catch (error) {
42+
console.error(error)
43+
res.status(500).send(error)
44+
}
45+
})
46+
47+
// GET /contents/:id
48+
router.get('/contents/:id', async (req: express.Request, res: express.Response) => {
49+
try {
50+
const content = await repository.findOne({
51+
where: { id: Number(req.params.id) },
52+
order: { id: 'ASC' },
53+
})
54+
if (content == null) {
55+
res.status(404).send()
56+
return
57+
}
58+
res.send(content)
59+
} catch (error) {
60+
console.error(error)
61+
res.status(500).send(error)
62+
}
63+
})
64+
65+
// PUT /contents/:id
66+
router.put('/contents/:id', async (req: express.Request, res: express.Response) => {
67+
try {
68+
const content = await repository.findOne({
69+
where: { id: Number(req.params.id) },
70+
})
71+
if (content == null) {
72+
res.status(404).send()
73+
return
74+
}
75+
76+
// PATCH的に一部更新も可能とする
77+
content.title = req.body.title || content.title
78+
content.body = req.body.body || content.body
79+
80+
await repository.save(content)
81+
res.send(content)
82+
} catch (error) {
83+
console.error(error)
84+
res.status(500).send(error)
85+
}
86+
})
87+
88+
// DELETE /contents/:id
89+
router.delete('/contents/:id', async (req: express.Request, res: express.Response) => {
90+
try {
91+
const content = await repository.findOne({
92+
where: { id: Number(req.params.id) },
93+
})
94+
if (content == null) {
95+
res.status(404).send()
96+
return
97+
}
98+
99+
await repository.remove(content)
100+
res.sendStatus(204).send()
101+
} catch (error) {
102+
console.error(error)
103+
res.status(500).send(error)
104+
}
105+
})
106+
107+
app.use(router)
108+
// 3000番ポートでAPIサーバ起動
109+
app.listen(3000, () => {
110+
console.log('Example app listening on port 3000!')
111+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { MigrationInterface, QueryRunner } from 'typeorm'
2+
3+
export class migrations1659710150627 implements MigrationInterface {
4+
name = 'migrations1659710150627'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(
8+
`CREATE TABLE \`content\` (\`id\` int NOT NULL AUTO_INCREMENT, \`title\` varchar(255) NOT NULL, \`body\` varchar(255) NOT NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`
9+
)
10+
}
11+
12+
public async down(queryRunner: QueryRunner): Promise<void> {
13+
await queryRunner.query(`DROP TABLE \`content\``)
14+
}
15+
}

‎samples/method/tsconfig.json

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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": "./", /* 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 '<reference>'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": "./", /* 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+
}

‎samples/method/yarn.lock

+2,296
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.