🤖 Merge PR #57916 [charcodes] Added new definitions by @dylanarmstrong

* feat: charcodes package added

* fix: remove namespace export

* chore: also commit tests
This commit is contained in:
Dylan Armstrong
2022-01-01 14:21:14 -06:00
committed by GitHub
parent 952e1282f1
commit 8ca5bfc5af
4 changed files with 245 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
import * as charcodes from 'charcodes';
charcodes.backSpace; // $ExpectType 8
charcodes.tab; // $ExpectType 9
charcodes.lineFeed; // $ExpectType 10
charcodes.carriageReturn; // $ExpectType 13
charcodes.shiftOut; // $ExpectType 14
charcodes.space; // $ExpectType 32
charcodes.exclamationMark; // $ExpectType 33
charcodes.quotationMark; // $ExpectType 34
charcodes.numberSign; // $ExpectType 35
charcodes.dollarSign; // $ExpectType 36
charcodes.percentSign; // $ExpectType 37
charcodes.ampersand; // $ExpectType 38
charcodes.apostrophe; // $ExpectType 39
charcodes.leftParenthesis; // $ExpectType 40
charcodes.rightParenthesis; // $ExpectType 41
charcodes.asterisk; // $ExpectType 42
charcodes.plusSign; // $ExpectType 43
charcodes.comma; // $ExpectType 44
charcodes.dash; // $ExpectType 45
charcodes.dot; // $ExpectType 46
charcodes.slash; // $ExpectType 47
charcodes.digit0; // $ExpectType 48
charcodes.digit1; // $ExpectType 49
charcodes.digit2; // $ExpectType 50
charcodes.digit3; // $ExpectType 51
charcodes.digit4; // $ExpectType 52
charcodes.digit5; // $ExpectType 53
charcodes.digit6; // $ExpectType 54
charcodes.digit7; // $ExpectType 55
charcodes.digit8; // $ExpectType 56
charcodes.digit9; // $ExpectType 57
charcodes.colon; // $ExpectType 58
charcodes.semicolon; // $ExpectType 59
charcodes.lessThan; // $ExpectType 60
charcodes.equalsTo; // $ExpectType 61
charcodes.greaterThan; // $ExpectType 62
charcodes.questionMark; // $ExpectType 63
charcodes.atSign; // $ExpectType 64
charcodes.uppercaseA; // $ExpectType 65
charcodes.uppercaseB; // $ExpectType 66
charcodes.uppercaseC; // $ExpectType 67
charcodes.uppercaseD; // $ExpectType 68
charcodes.uppercaseE; // $ExpectType 69
charcodes.uppercaseF; // $ExpectType 70
charcodes.uppercaseG; // $ExpectType 71
charcodes.uppercaseH; // $ExpectType 72
charcodes.uppercaseI; // $ExpectType 73
charcodes.uppercaseJ; // $ExpectType 74
charcodes.uppercaseK; // $ExpectType 75
charcodes.uppercaseL; // $ExpectType 76
charcodes.uppercaseM; // $ExpectType 77
charcodes.uppercaseN; // $ExpectType 78
charcodes.uppercaseO; // $ExpectType 79
charcodes.uppercaseP; // $ExpectType 80
charcodes.uppercaseQ; // $ExpectType 81
charcodes.uppercaseR; // $ExpectType 82
charcodes.uppercaseS; // $ExpectType 83
charcodes.uppercaseT; // $ExpectType 84
charcodes.uppercaseU; // $ExpectType 85
charcodes.uppercaseV; // $ExpectType 86
charcodes.uppercaseW; // $ExpectType 87
charcodes.uppercaseX; // $ExpectType 88
charcodes.uppercaseY; // $ExpectType 89
charcodes.uppercaseZ; // $ExpectType 90
charcodes.leftSquareBracket; // $ExpectType 91
charcodes.backslash; // $ExpectType 92
charcodes.rightSquareBracket; // $ExpectType 93
charcodes.caret; // $ExpectType 94
charcodes.underscore; // $ExpectType 95
charcodes.graveAccent; // $ExpectType 96
charcodes.lowercaseA; // $ExpectType 97
charcodes.lowercaseB; // $ExpectType 98
charcodes.lowercaseC; // $ExpectType 99
charcodes.lowercaseD; // $ExpectType 100
charcodes.lowercaseE; // $ExpectType 101
charcodes.lowercaseF; // $ExpectType 102
charcodes.lowercaseG; // $ExpectType 103
charcodes.lowercaseH; // $ExpectType 104
charcodes.lowercaseI; // $ExpectType 105
charcodes.lowercaseJ; // $ExpectType 106
charcodes.lowercaseK; // $ExpectType 107
charcodes.lowercaseL; // $ExpectType 108
charcodes.lowercaseM; // $ExpectType 109
charcodes.lowercaseN; // $ExpectType 110
charcodes.lowercaseO; // $ExpectType 111
charcodes.lowercaseP; // $ExpectType 112
charcodes.lowercaseQ; // $ExpectType 113
charcodes.lowercaseR; // $ExpectType 114
charcodes.lowercaseS; // $ExpectType 115
charcodes.lowercaseT; // $ExpectType 116
charcodes.lowercaseU; // $ExpectType 117
charcodes.lowercaseV; // $ExpectType 118
charcodes.lowercaseW; // $ExpectType 119
charcodes.lowercaseX; // $ExpectType 120
charcodes.lowercaseY; // $ExpectType 121
charcodes.lowercaseZ; // $ExpectType 122
charcodes.leftCurlyBrace; // $ExpectType 123
charcodes.verticalBar; // $ExpectType 124
charcodes.rightCurlyBrace; // $ExpectType 125
charcodes.tilde; // $ExpectType 126
charcodes.nonBreakingSpace; // $ExpectType 160
charcodes.oghamSpaceMark; // $ExpectType 5760
charcodes.lineSeparator; // $ExpectType 8232
charcodes.paragraphSeparator; // $ExpectType 8233
charcodes.isDigit(5); // $ExpectType boolean

114
types/charcodes/index.d.ts vendored Normal file
View File

@@ -0,0 +1,114 @@
// Type definitions for charcodes 0.2
// Project: https://github.com/xtuc/charcodes
// Definitions by: Dylan Armstrong <https://github.com/dylanarmstrong>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Char codes constants
*/
export const backSpace: 8;
export const tab: 9; // '\t'
export const lineFeed: 10; // '\n'
export const carriageReturn: 13; // '\r'
export const shiftOut: 14;
export const space: 32;
export const exclamationMark: 33; // '!'
export const quotationMark: 34; // '"'
export const numberSign: 35; // '#'
export const dollarSign: 36; // '$'
export const percentSign: 37; // '%'
export const ampersand: 38; // '&'
export const apostrophe: 39; // '''
export const leftParenthesis: 40; // '('
export const rightParenthesis: 41; // ')'
export const asterisk: 42; // '*'
export const plusSign: 43; // '+'
export const comma: 44; // ','
export const dash: 45; // '-'
export const dot: 46; // '.'
export const slash: 47; // '/'
export const digit0: 48; // '0'
export const digit1: 49; // '1'
export const digit2: 50; // '2'
export const digit3: 51; // '3'
export const digit4: 52; // '4'
export const digit5: 53; // '5'
export const digit6: 54; // '6'
export const digit7: 55; // '7'
export const digit8: 56; // '8'
export const digit9: 57; // '9'
export const colon: 58; // ':'
export const semicolon: 59; // ';'
export const lessThan: 60; // '<'
export const equalsTo: 61; // '='
export const greaterThan: 62; // '>'
export const questionMark: 63; // '?'
export const atSign: 64; // '@'
export const uppercaseA: 65; // 'A'
export const uppercaseB: 66; // 'B'
export const uppercaseC: 67; // 'C'
export const uppercaseD: 68; // 'D'
export const uppercaseE: 69; // 'E'
export const uppercaseF: 70; // 'F'
export const uppercaseG: 71; // 'G'
export const uppercaseH: 72; // 'H'
export const uppercaseI: 73; // 'I'
export const uppercaseJ: 74; // 'J'
export const uppercaseK: 75; // 'K'
export const uppercaseL: 76; // 'L'
export const uppercaseM: 77; // 'M'
export const uppercaseN: 78; // 'N'
export const uppercaseO: 79; // 'O'
export const uppercaseP: 80; // 'P'
export const uppercaseQ: 81; // 'Q'
export const uppercaseR: 82; // 'R'
export const uppercaseS: 83; // 'S'
export const uppercaseT: 84; // 'T'
export const uppercaseU: 85; // 'U'
export const uppercaseV: 86; // 'V'
export const uppercaseW: 87; // 'W'
export const uppercaseX: 88; // 'X'
export const uppercaseY: 89; // 'Y'
export const uppercaseZ: 90; // 'Z'
export const leftSquareBracket: 91; // '['
export const backslash: 92; // '\ '
export const rightSquareBracket: 93; // ']'
export const caret: 94; // '^'
export const underscore: 95; // '_'
export const graveAccent: 96; // '`'
export const lowercaseA: 97; // 'a'
export const lowercaseB: 98; // 'b'
export const lowercaseC: 99; // 'c'
export const lowercaseD: 100; // 'd'
export const lowercaseE: 101; // 'e'
export const lowercaseF: 102; // 'f'
export const lowercaseG: 103; // 'g'
export const lowercaseH: 104; // 'h'
export const lowercaseI: 105; // 'i'
export const lowercaseJ: 106; // 'j'
export const lowercaseK: 107; // 'k'
export const lowercaseL: 108; // 'l'
export const lowercaseM: 109; // 'm'
export const lowercaseN: 110; // 'n'
export const lowercaseO: 111; // 'o'
export const lowercaseP: 112; // 'p'
export const lowercaseQ: 113; // 'q'
export const lowercaseR: 114; // 'r'
export const lowercaseS: 115; // 's'
export const lowercaseT: 116; // 't'
export const lowercaseU: 117; // 'u'
export const lowercaseV: 118; // 'v'
export const lowercaseW: 119; // 'w'
export const lowercaseX: 120; // 'x'
export const lowercaseY: 121; // 'y'
export const lowercaseZ: 122; // 'z'
export const leftCurlyBrace: 123; // '{'
export const verticalBar: 124; // '|'
export const rightCurlyBrace: 125; // '}'
export const tilde: 126; // '~'
export const nonBreakingSpace: 160;
export const oghamSpaceMark: 5760;
export const lineSeparator: 8232;
export const paragraphSeparator: 8233;
export function isDigit(code: number): boolean;

View File

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

View File

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