microgears: Provides its own types (#22356)

This commit is contained in:
Andy
2018-01-02 08:52:34 -08:00
committed by GitHub
parent 0ed1b1d0c5
commit 5808430bfa
5 changed files with 6 additions and 192 deletions
+6
View File
@@ -642,6 +642,12 @@
"sourceRepoURL": "https://github.com/onokumus/metisMenu",
"asOfVersion": "2.7.1"
},
{
"libraryName": "microgears",
"typingsPackageName": "microgears",
"sourceRepoURL": "https://github.com/marcusdb/microgears",
"asOfVersion": "4.0.5"
},
{
"libraryName": "mobservable",
"typingsPackageName": "mobservable",
-31
View File
@@ -1,31 +0,0 @@
// Type definitions for microgears v4.0.0
// Project: https://github.com/marcusdb/microgears
// Definitions by: Marcus David Bronstein <https://github.com/marcusdb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace microgears {
export interface Service {
name: string;
async?: boolean;
pathname?: string;
namespace: string;
}
interface MetaInformation {
serviceName: string;
methodName: string;
serviceNameSpace: string;
extra: any;
}
interface Plugin {
name: string;
beforeChain(args: Array<any>, metaInfo: MetaInformation): Array<any>;
afterChain<T>(result: T, metaInfo: MetaInformation): T;
}
function addService(service: Service): Service;
function addPlugin(plugin: Plugin): void;
}
export = microgears;
-58
View File
@@ -1,58 +0,0 @@
import microgears = require("microgears");
function verify_module_file() {
var tracePlugin = new TracePlugin();
microgears.addPlugin(tracePlugin);
var service = new UserService();
var userService = microgears.addService(service);
}
class TracePlugin implements microgears.Plugin {
name: 'TracePlugin';
public beforeChain(args:Array<any>, _meta: microgears.MetaInformation) {
var serviceName = _meta.serviceName,
method = _meta.methodName;
console.log('before call-> ' + serviceName + '.' + method);
_meta.extra = {
count: 1
};
return args
}
public afterChain(result:any, _meta: microgears.MetaInformation) {
var serviceName = _meta.serviceName,
method = _meta.methodName;
console.log('after of-> ' + serviceName + '.' + method);
if (_meta.extra.count) {
console.log('this number comes to the beforeChain: ' + _meta.extra.count);
}
return result;
}
}
class User {
name: string;
email: string;
constructor(name: string, email: string) {
this.email = email;
this.name = name;
}
}
class UserService implements microgears.Service {
name: string = "userService";
namespace: string = "services.user";
public findUserById(id: number) {
return new User('test', 'test@example.com');
}
}
-24
View File
@@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"microgears-tests.ts"
]
}
-79
View File
@@ -1,79 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}