add types for @hapi/catbox-memcached (#42728)

This commit is contained in:
Avery Fay 2020-03-02 10:44:13 -08:00 committed by GitHub
parent ec7cccef2d
commit fde43b408a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import CatboxMemcached = require('@hapi/catbox-memcached');
import { Server } from '@hapi/hapi';
new CatboxMemcached<string>();
const options: CatboxMemcached.Options = {
host: 'test',
port: 0,
timeout: 0,
idle: 0,
partition: 'test',
};
new Server({
cache: {
provider: {
constructor: CatboxMemcached,
options,
},
},
});

25
types/hapi__catbox-memcached/index.d.ts vendored Normal file
View File

@ -0,0 +1,25 @@
// Type definitions for @hapi/catbox-memcached 3.0
// Project: https://github.com/hapijs/catbox-memcached#readme
// Definitions by: Avery Fay <https://github.com/btmorex>
// 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<T> extends ClientApi<T> {}
declare class CatboxMemcached<T> implements ClientApi<T> {
constructor(options?: CatboxMemcached.Options);
generateKey(key: CacheKey): string;
}
export = CatboxMemcached;

View File

@ -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"]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }