Skip to content

Commit 98adc91

Browse files
authored
🤖 Merge PR DefinitelyTyped#72404 feat(certstream): add types by @hkleungai
1 parent 157c1b6 commit 98adc91

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

types/certstream/.npmignore

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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import CertStreamClient from "certstream";
2+
3+
// $ExpectType typeof CertStreamClient
4+
CertStreamClient;
5+
6+
new CertStreamClient(
7+
(message, context) => {
8+
// $ExpectType any
9+
message;
10+
// $ExpectType any
11+
context;
12+
},
13+
);
14+
15+
new CertStreamClient(
16+
(message, context) => {
17+
// $ExpectType any
18+
message;
19+
// $ExpectType any
20+
context;
21+
},
22+
true,
23+
);
24+
25+
declare let client: CertStreamClient;
26+
27+
// $ExpectType Callback
28+
client.callback;
29+
// $ExpectType any
30+
client.context;
31+
// $ExpectType boolean
32+
client.skipHeartbeats;
33+
// $ExpectType void
34+
client.connect();

types/certstream/index.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare namespace CertStreamClient {
2+
type Callback = (message: any, context: any) => void;
3+
}
4+
5+
declare class CertStreamClient {
6+
context: any;
7+
callback: CertStreamClient.Callback;
8+
skipHeartbeats: boolean;
9+
10+
constructor(callback: CertStreamClient.Callback, skipHeartbeats?: boolean);
11+
12+
connect(url?: string): void;
13+
}
14+
15+
export = CertStreamClient;
16+
export as namespace CertStreamClient;

types/certstream/package.json

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/certstream",
4+
"version": "1.1.9999",
5+
"projects": [
6+
"https://github.com/CaliDog/certstream-js#readme"
7+
],
8+
"devDependencies": {
9+
"@types/certstream": "workspace:."
10+
},
11+
"owners": [
12+
{
13+
"name": "Jimmy Leung",
14+
"githubUsername": "hkleungai"
15+
}
16+
]
17+
}

types/certstream/tsconfig.json

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+
"certstream-tests.ts"
18+
]
19+
}

0 commit comments

Comments
 (0)