feat: add noImplicitAny config
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
6c61f14907
commit
e67fe154de
@ -7,17 +7,17 @@ export class MongoDBConnection {
|
||||
private static isConnected: boolean = false;
|
||||
private static db: Db;
|
||||
|
||||
public static getConnection(result: (connection) => void) {
|
||||
public static getConnection(result: (connection: Db) => void) {
|
||||
if (this.isConnected) {
|
||||
return result(this.db);
|
||||
} else {
|
||||
this.connect((error, db: Db) => {
|
||||
this.connect((error: Error, db: Db) => {
|
||||
return result(this.db);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static connect(result: (error, db: Db) => void) {
|
||||
private static connect(result: (error: Error, db: Db) => void) {
|
||||
MongoClient.connect(connStr, { useNewUrlParser: true }, (err, client) => {
|
||||
this.db = client.db(dbName);
|
||||
this.isConnected = true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import "reflect-metadata";
|
||||
import { Container, inject } from 'inversify';
|
||||
import { Container, inject, interfaces } from 'inversify';
|
||||
import { autoProvide, provide, fluentProvide, buildProviderModule } from 'inversify-binding-decorators';
|
||||
|
||||
let container = new Container();
|
||||
@ -7,13 +7,13 @@ let container = new Container();
|
||||
// a module to be loaded by the container
|
||||
// container.load(buildProviderModule());
|
||||
|
||||
const provideNamed = (identifier, name) => {
|
||||
const provideNamed = (identifier: interfaces.ServiceIdentifier<any>, name: string) => {
|
||||
return fluentProvide(identifier)
|
||||
.whenTargetNamed(name)
|
||||
.done();
|
||||
};
|
||||
|
||||
const provideSingleton = (identifier: any) => {
|
||||
const provideSingleton = (identifier: interfaces.ServiceIdentifier<any>) => {
|
||||
return fluentProvide(identifier)
|
||||
.inSingletonScope()
|
||||
.done();
|
||||
|
@ -6,6 +6,7 @@
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"noImplicitAny": true,
|
||||
"allowUnreachableCode": true,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true
|
||||
|
Loading…
Reference in New Issue
Block a user