Skip to content

Commit 5e16e2c

Browse files
authored
🤖 Merge PR DefinitelyTyped#73112 feat: adding types for uuid-encoder (https://www.npmjs.com/package/uuid-encoder) by @mvhenten
1 parent 8cf1688 commit 5e16e2c

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export = UuidEncoder;
2+
declare class UuidEncoder {
3+
private static resolveEncodingStr;
4+
static isCaseSensitiveBase(baseEncodingStr: string): boolean;
5+
constructor(baseEncodingStr?: string);
6+
setBaseEncodingStr(baseEncodingStr: string): void;
7+
encStr: string;
8+
isCaseSensitive: boolean;
9+
base: number;
10+
encode(uuid: string): string;
11+
decode(str: string): string;
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"private": true,
3+
"name": "@types/uuid-encoder",
4+
"version": "1.2.9999",
5+
"projects": [
6+
"https://github.com/salieri/uuid-encoder#readme"
7+
],
8+
"devDependencies": {
9+
"@types/uuid-encoder": "workspace:."
10+
},
11+
"owners": [
12+
{
13+
"name": "Matthijs van Henten",
14+
"githubUsername": "mvhenten"
15+
}
16+
]
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"module": "node16",
4+
"lib": [
5+
"es6"
6+
],
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"strictFunctionTypes": true,
10+
"strictNullChecks": true,
11+
"types": [],
12+
"noEmit": true,
13+
"forceConsistentCasingInFileNames": true
14+
},
15+
"files": [
16+
"index.d.ts",
17+
"uuid-encoder-tests.ts"
18+
]
19+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import UuidEncoder from "uuid-encoder";
2+
3+
// $ExpectType UuidEncoder
4+
const encoder = new UuidEncoder('base36');
5+
6+
// $ExpectType string
7+
const encodedUuid = encoder.encode('38b9823d-fa1a-48e7-91fc-ee16ad091cf2');
8+
9+
// $ExpectType string
10+
const decodedUuid = encoder.decode(encodedUuid);
11+
12+

0 commit comments

Comments
 (0)