Skip to content

Commit

Permalink
馃摉 DOC: Use @eggjs/tsconfig for tsconfig.json (#5066)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Dec 9, 2022
1 parent 9a83bbe commit c76e16c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 50 deletions.
32 changes: 7 additions & 25 deletions site/docs/tutorials/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ Unit Test is a MUST in development:

```typescript
// test/app/service/news.test.ts
import * as assert from 'assert';
import assert from 'assert';
import { Context } from 'egg';
import { app } from 'egg-mock/bootstrap';

Expand Down Expand Up @@ -495,8 +495,12 @@ Configs in `package.json` :

```json
{
"devDependencies": {
"@eggjs/tsconfig": "^1.0.0"
},
"egg": {
"typescript": true
"typescript": true,
"declarations": true
},
"scripts": {
"start": "egg-scripts start --title=egg-server-showcase",
Expand All @@ -512,29 +516,7 @@ And the corresponding `tsconfig.json`:

```json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"strict": true,
"noImplicitAny": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"charset": "utf8",
"allowJs": false,
"pretty": true,
"noEmitOnError": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"strictPropertyInitialization": false,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"inlineSourceMap": true,
"importHelpers": true
},
"extends": "@eggjs/tsconfig",
"exclude": ["app/public", "app/web", "app/views"]
}
```
Expand Down
34 changes: 9 additions & 25 deletions site/docs/tutorials/typescript.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ declare module 'egg' {

```typescript
// test/app/service/news.test.ts
import * as assert from 'assert';
import assert from 'assert';
import { Context } from 'egg';
import { app } from 'egg-mock/bootstrap';

Expand All @@ -451,6 +451,7 @@ describe('test/app/service/news.test.js', () => {
{
"name": "showcase",
"egg": {
"typescript": true,
"declarations": true
},
"scripts": {
Expand All @@ -470,6 +471,7 @@ describe('test/app/service/news.test.js', () => {
{
"name": "showcase",
"egg": {
"typescript": true,
"declarations": true
},
"scripts": {
Expand All @@ -494,8 +496,12 @@ describe('test/app/service/news.test.js', () => {

```json
{
"devDependencies": {
"@eggjs/tsconfig": "^1.0.0"
},
"egg": {
"typescript": true
"typescript": true,
"declarations": true
},
"scripts": {
"start": "egg-scripts start --title=egg-server-showcase",
Expand All @@ -511,29 +517,7 @@ describe('test/app/service/news.test.js', () => {

```json
{
"compileOnSave": true,
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"strict": true,
"noImplicitAny": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"charset": "utf8",
"allowJs": false,
"pretty": true,
"noEmitOnError": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"strictPropertyInitialization": false,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"inlineSourceMap": true,
"importHelpers": true
},
"extends": "@eggjs/tsconfig",
"exclude": ["app/public", "app/web", "app/views"]
}
```
Expand Down

0 comments on commit c76e16c

Please sign in to comment.