Skip to content

Commit de4f63f

Browse files
committed
fix: typescript new version not support 'get' and 'set' accessors cannot declare this parameters
1 parent 992f295 commit de4f63f

File tree

11 files changed

+27
-23
lines changed

11 files changed

+27
-23
lines changed

app/extend/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import DB from '../lib/db/base';
33
import DBFactory from '../lib/db/factory';
44
const DBSymbol = Symbol('Application#db');
55
export default {
6-
get db(this: Application): DB {
6+
get db(): DB {
77
// if (!this[DBSymbol]) {
88
// this[DBSymbol] = DBFactory();
99
// }

app/extend/context.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { Context } from 'egg';
33
import DB from '../lib/db/base';
44
export default {
5-
get db(this: Context): DB {
6-
return this.app.db;
5+
get db(): DB {
6+
return (this as Context).app.db;
77
}
88
};

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
},
1919
"dependencies": {
2020
"@hubcarl/json-typescript-mapper": "2.0.0",
21+
"axios": "^0.18.1",
22+
"egg": "^2.3.0",
23+
"egg-cors": "^2.1.1",
24+
"egg-scripts": "^2.10.0",
25+
"egg-view-vue-ssr": "^3.0.5",
26+
"egg-webpack": "^4.4.7",
27+
"egg-webpack-vue": "^2.0.0",
2128
"element-ui": "^2.0.8",
2229
"extend": "~3.0.0",
2330
"font-awesome": "^4.7.0",
@@ -29,19 +36,12 @@
2936
"shortid": "^2.2.8",
3037
"showdown": "^1.8.6",
3138
"simplemde": "^1.11.2",
32-
"axios": "^0.18.1",
33-
"egg": "^2.3.0",
34-
"egg-scripts": "^2.10.0",
35-
"egg-cors": "^2.1.1",
36-
"egg-webpack": "^4.4.7",
37-
"egg-webpack-vue": "^2.0.0",
38-
"egg-view-vue-ssr": "^3.0.5",
3939
"vue": "^2.5.0",
40+
"vue-property-decorator": "^7.2.0",
4041
"vue-router": "^3.0.1",
4142
"vuex": "^3.0.1",
42-
"vuex-router-sync": "^5.0.0",
43-
"vue-property-decorator": "^7.2.0",
44-
"vuex-class": "^0.3.1"
43+
"vuex-class": "^0.3.1",
44+
"vuex-router-sync": "^5.0.0"
4545
},
4646
"devDependencies": {
4747
"@types/lodash": "^4.14.117",
@@ -59,7 +59,7 @@
5959
"ts-node": "^7.0.1",
6060
"tslint": "^5.9.1",
6161
"tslint-loader": "^3.5.3",
62-
"typescript": "^3.0.0"
62+
"typescript": "^3.9.2"
6363
},
6464
"egg": {
6565
"typescript": true

typings/app/controller/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/extend/application.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/extend/context.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/middleware/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/model/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';

typings/app/service/index.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
// This file is created by [email protected].6
1+
// This file is created by [email protected].8
22
// Do not modify this file!!!!!!!!!
33

44
import 'egg';
5+
type AnyClass = new (...args: any[]) => any;
6+
type AnyFunc<T = any> = (...args: any[]) => T;
7+
type CanExportFunc = AnyFunc<Promise<any>> | AnyFunc<IterableIterator<any>>;
8+
type AutoInstanceType<T, U = T extends CanExportFunc ? T : T extends AnyFunc ? ReturnType<T> : T> = U extends AnyClass ? InstanceType<U> : U;
59
import ExportArticle from '../../../app/service/article';
610

711
declare module 'egg' {
812
interface IService {
9-
article: ExportArticle;
13+
article: AutoInstanceType<typeof ExportArticle>;
1014
}
1115
}

0 commit comments

Comments
 (0)