mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
definitions for hat
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import * as hat from 'hat';
|
||||
|
||||
const randomId = hat();
|
||||
|
||||
const rack = hat.rack();
|
||||
rack('car');
|
||||
const tractorId = rack('tractor');
|
||||
rack.get(tractorId);
|
||||
rack.set(randomId, 'bicycle');
|
||||
rack.hats;
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for hat 0.0
|
||||
// Project: https://github.com/substack/node-hat
|
||||
// Definitions by: Sasha Grin <https://github.com/tup1tsa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface HatsList {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface Rack {
|
||||
bits: number;
|
||||
base: number;
|
||||
hats: HatsList;
|
||||
|
||||
(data: any): string;
|
||||
get(id: string): any;
|
||||
set(id: string, value: any): Rack;
|
||||
}
|
||||
|
||||
type CreateRack = (bits?: number, base?: number, expandBy?: number) => Rack;
|
||||
|
||||
interface Hat {
|
||||
(bits?: number, base?: number): string;
|
||||
rack: CreateRack;
|
||||
}
|
||||
|
||||
declare const hat: Hat;
|
||||
export = hat;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"hat-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user