[parse-key] Add parse-key types (#47044)

This commit is contained in:
Nathan Bierema 2020-08-27 20:05:20 -04:00 committed by GitHub
parent d9e47130b5
commit 8210bd361a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 0 deletions

16
types/parse-key/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
// Type definitions for parse-key 0.2
// Project: https://github.com/thlorenz/parse-key
// Definitions by: Nathan Bierema <https://github.com/Methuselah96>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface KeyObject {
name: string;
ctrl: boolean;
meta: boolean;
shift: boolean;
alt: boolean;
sequence: string;
}
declare function parse(s: string): KeyObject;
export = parse;

View File

@ -0,0 +1,9 @@
import parseKey = require('parse-key');
const visibilityKey = parseKey('ctrl-c');
visibilityKey.name;
visibilityKey.ctrl;
visibilityKey.alt;
visibilityKey.meta;
visibilityKey.sequence;
visibilityKey.shift;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"parse-key-tests.ts"
]
}

View File

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