Merge pull request #24502 from garfty/master

Glue: Moved typings to types folder
This commit is contained in:
Mine Starks
2018-03-24 19:42:42 -07:00
committed by GitHub
5 changed files with 34 additions and 38 deletions

35
glue/index.d.ts vendored
View File

@@ -1,35 +0,0 @@
// Type definitions for glue
// Project: https://github.com/hapijs/glue
// Definitions by: Gareth Parker
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
declare module "glue" {
import { Server, ServerOptions } from "hapi";
export interface Options {
relativeTo: string;
preConnections?: (Server:Server, next:(err:any)=>void ) => void;
preRegister?: (Server:Server, next:(err:any)=>void ) => void;
}
interface Plugin {
plugin: string | {
register:string;
options?:any;
};
options?: any;
routes?: any
}
interface Manifest {
server: ServerOptions;
register?: {
plugins: Array<Plugin>
}
}
export function compose(manifest: Manifest, options?: Options): Server;
}

View File

@@ -15,6 +15,6 @@ const manifest: Glue.Manifest = {
}
]
}
}
};
Glue.compose(manifest);
Glue.compose(manifest);

31
types/glue/index.d.ts vendored Normal file
View File

@@ -0,0 +1,31 @@
// Type definitions for glue 5.0
// Project: https://github.com/hapijs/glue
// Definitions by: Gareth Parker <https://github.com/garfty>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import { Server, ServerOptions } from "hapi";
export interface Options {
relativeTo: string;
preConnections?: (Server: Server, next: (err: any) => void) => void;
preRegister?: (Server: Server, next: (err: any) => void) => void;
}
export interface Plugin {
plugin: string | {
register: string;
options?: any;
};
options?: any;
routes?: any;
}
export interface Manifest {
server: ServerOptions;
register?: {
plugins: Plugin[]
};
}
export function compose(manifest: Manifest, options?: Options): Server;

View File

@@ -21,6 +21,6 @@
},
"files": [
"index.d.ts",
"hapi-glue-test.ts"
"glue-tests.ts"
]
}