mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
types declaration for architect (#34993)
This commit is contained in:
committed by
Pranav Senthilnathan
parent
4b7b454e31
commit
32cd2e644a
21
types/architect/architect-tests.ts
Normal file
21
types/architect/architect-tests.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as architect from 'architect';
|
||||
|
||||
architect.loadConfig('./fake-path', (err, config) => {
|
||||
if (err) throw err;
|
||||
const myApp = architect.createApp(config, (err, app) => {
|
||||
if (err) throw err;
|
||||
console.log('App ready');
|
||||
});
|
||||
|
||||
myApp.on('service', (name, service) => {
|
||||
console.log('Service registered %s', name);
|
||||
});
|
||||
|
||||
myApp.on('plugin', (plugin) => {
|
||||
console.log('Plugin registered', plugin);
|
||||
});
|
||||
|
||||
myApp.on('ready', (app) => {
|
||||
console.log('All plugins loaded');
|
||||
});
|
||||
});
|
||||
23
types/architect/index.d.ts
vendored
Normal file
23
types/architect/index.d.ts
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// Type definitions for architect 0.1
|
||||
// Project: https://github.com/c9/architect#readme
|
||||
// Definitions by: Ivan Lopez <https://github.com/greuze>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
export type Config = any;
|
||||
export type Service = any;
|
||||
export type Plugin = any;
|
||||
|
||||
export function loadConfig(configPath: string, callback?: (err: Error, config: Config) => void): void;
|
||||
export function createApp(config: Config, callback?: (err: Error, app: Architect) => void): Architect;
|
||||
|
||||
export interface Architect extends EventEmitter {
|
||||
on(event: "service", listener: (name: string, service: Service, plugin: Plugin) => void): this;
|
||||
on(event: "plugin", listener: (plugin: Plugin) => void): this;
|
||||
on(event: "ready", listener: (app: Architect) => void): this;
|
||||
on(event: "error", listener: (error: Error) => void): this;
|
||||
getService(name: string): any;
|
||||
}
|
||||
23
types/architect/tsconfig.json
Normal file
23
types/architect/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"architect-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/architect/tslint.json
Normal file
1
types/architect/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user