Skip to content

Commit

Permalink
add new types
Browse files Browse the repository at this point in the history
  • Loading branch information
XenoPOMP committed Jul 27, 2023
1 parent 3cfd812 commit 908a6fb
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ type PartialAddress = DeepPartial<Address>;
// }
// }
```

And other...
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xenopomp/advanced-types",
"version": "1.0.4",
"version": "1.0.5",
"description": "Library of advanced TypeScript types for React and Node projects.",
"main": "src/index.ts",
"types": "dist/index.d.ts",
Expand Down
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { DeepPartial } from 'redux';
import { ArrayType } from './types/ArrayType';
import { Defined } from './types/Defined';
import { Empty } from './types/Empty';
import { EsmImport } from './types/EsmImport';
import { KeyCodes } from './types/KeyCodes';
import { MetaInfo } from './types/MetaInfo';
import { Modify } from './types/Modify';
import { PropsWith } from './types/PropsWith';
import { PropsWithClassnames } from './types/PropsWithClassnames';
Expand All @@ -25,4 +28,7 @@ export {
DeepPartial,
RecordKey,
RecordValue,
EsmImport,
KeyCodes,
MetaInfo,
};
8 changes: 8 additions & 0 deletions src/types/EsmImport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ComponentType } from 'react';

/**
* This type is ES Module import alias.
*/
export type EsmImport<Import extends any = ComponentType<any>> = () => Promise<{
default: Import;
}>;
106 changes: 106 additions & 0 deletions src/types/KeyCodes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
export const KeyCodes = {
Backspace: 'Backspace',
Tab: 'Tab',
Enter: 'Enter',
ShiftLeft: 'ShiftLeft',
ShiftRight: 'ShiftRight',
ControlLeft: 'ControlLeft',
ControlRight: 'ControlRight',
AltLeft: 'AltLeft',
Pause: 'Pause',
CapsLock: 'CapsLock',
Escape: 'Escape',
Space: 'Space',
PageUp: 'PageUp',
PageDown: 'PageDown',
End: 'End',
Home: 'Home',
ArrowLeft: 'ArrowLeft',
ArrowUp: 'ArrowUp',
ArrowRight: 'ArrowRight',
ArrowDown: 'ArrowDown',
PrintScreen: 'PrintScreen',
Insert: 'Insert',
Delete: 'Delete',
'0': 'Digit0',
'1': 'Digit1',
'2': 'Digit2',
'3': 'Digit3',
'4': 'Digit4',
'5': 'Digit5',
'6': 'Digit6',
'7': 'Digit7',
'8': 'Digit8',
'9': 'Digit9',
A: 'KeyA',
B: 'KeyB',
C: 'KeyC',
D: 'KeyD',
E: 'KeyE',
F: 'KeyF',
G: 'KeyG',
H: 'KeyH',
I: 'KeyI',
J: 'KeyJ',
K: 'KeyK',
L: 'KeyL',
M: 'KeyM',
N: 'KeyN',
O: 'KeyO',
P: 'KeyP',
Q: 'KeyQ',
R: 'KeyR',
S: 'KeyS',
T: 'KeyT',
U: 'KeyU',
V: 'KeyV',
W: 'KeyW',
X: 'KeyX',
Y: 'KeyY',
Z: 'KeyZ',
/** Left Windows key */
MetaLeft: 'MetaLeft',
/** Right Windows key */
MetaRight: 'MetaRight',
ContextMenu: 'ContextMenu',
Numpad0: 'Numpad0',
Numpad1: 'Numpad1',
Numpad2: 'Numpad2',
Numpad3: 'Numpad3',
Numpad4: 'Numpad4',
Numpad5: 'Numpad5',
Numpad6: 'Numpad6',
Numpad7: 'Numpad7',
Numpad8: 'Numpad8',
Numpad9: 'Numpad9',
NumpadMultiply: 'NumpadMultiply',
NumpadAdd: 'NumpadAdd',
NumpadSubtract: 'NumpadSubtract',
NumpadDecimal: 'NumpadDecimal',
NumpadDivide: 'NumpadDivide',
F1: 'F1',
F2: 'F2',
F3: 'F3',
F4: 'F4',
F5: 'F5',
F6: 'F6',
F7: 'F7',
F8: 'F8',
F9: 'F9',
F10: 'F10',
F11: 'F11',
F12: 'F12',
NumLock: 'NumLock',
ScrollLock: 'ScrollLock',
Semicolon: 'Semicolon',
Equal: 'Equal',
Comma: 'Comma',
Minus: 'Minus',
Period: 'Period',
Slash: 'Slash',
Backquote: 'Backquote',
BracketLeft: 'BracketLeft',
Backslash: 'Backslash',
BracketRight: 'BracketRight',
Quote: 'Quote',
};
5 changes: 5 additions & 0 deletions src/types/MetaInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface MetaInfo {
title: string;
description?: string;
keywords?: string;
}

0 comments on commit 908a6fb

Please sign in to comment.