diff --git a/types/hapi__catbox-memcached/hapi__catbox-memcached-tests.ts b/types/hapi__catbox-memcached/hapi__catbox-memcached-tests.ts new file mode 100644 index 0000000000..0bb717781f --- /dev/null +++ b/types/hapi__catbox-memcached/hapi__catbox-memcached-tests.ts @@ -0,0 +1,21 @@ +import CatboxMemcached = require('@hapi/catbox-memcached'); +import { Server } from '@hapi/hapi'; + +new CatboxMemcached(); + +const options: CatboxMemcached.Options = { + host: 'test', + port: 0, + timeout: 0, + idle: 0, + partition: 'test', +}; + +new Server({ + cache: { + provider: { + constructor: CatboxMemcached, + options, + }, + }, +}); diff --git a/types/hapi__catbox-memcached/index.d.ts b/types/hapi__catbox-memcached/index.d.ts new file mode 100644 index 0000000000..41b02d3fe9 --- /dev/null +++ b/types/hapi__catbox-memcached/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for @hapi/catbox-memcached 3.0 +// Project: https://github.com/hapijs/catbox-memcached#readme +// Definitions by: Avery Fay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { CacheKey, ClientApi, ClientOptions } from '@hapi/catbox'; + +declare namespace CatboxMemcached { + interface Options extends ClientOptions { + host?: string; + port?: number; + location?: string; + timeout?: number; + idle?: number; + } +} + +interface CatboxMemcached extends ClientApi {} + +declare class CatboxMemcached implements ClientApi { + constructor(options?: CatboxMemcached.Options); + generateKey(key: CacheKey): string; +} + +export = CatboxMemcached; diff --git a/types/hapi__catbox-memcached/tsconfig.json b/types/hapi__catbox-memcached/tsconfig.json new file mode 100644 index 0000000000..eb465136a4 --- /dev/null +++ b/types/hapi__catbox-memcached/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "paths": { + "@hapi/catbox": ["hapi__catbox"], + "@hapi/catbox-memcached": ["hapi__catbox-memcached"], + "@hapi/hapi": ["hapi__hapi"], + "@hapi/joi": ["hapi__joi"], + "@hapi/mimos": ["hapi__mimos"], + "@hapi/podium": ["hapi__podium"], + "@hapi/shot": ["hapi__shot"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "hapi__catbox-memcached-tests.ts"] +} diff --git a/types/hapi__catbox-memcached/tslint.json b/types/hapi__catbox-memcached/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/hapi__catbox-memcached/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }