1
- import { z } from "zod" ;
1
+ const { z } = require ( "zod" ) ;
2
2
3
3
// Fields we want to extract from user profile
4
4
const OutputUser = z . object ( {
@@ -13,12 +13,12 @@ const OutputUser = z.object({
13
13
state : z . string ( ) . nullish ( ) ,
14
14
bio : z . string ( ) . nullish ( ) ,
15
15
recent : z . string ( ) . nullish ( ) ,
16
- twitter_username : z . string ( ) . transform ( ( val ) => val && `[@${ val } ](https://twitter.com/${ val } )` ) . nullish ( ) ,
16
+ twitter_username : z . string ( ) . transform ( ( val : any ) => val && `[@${ val } ](https://twitter.com/${ val } )` ) . nullish ( ) ,
17
17
public_repos : z . number ( ) . nullish ( ) ,
18
18
public_gists : z . number ( ) . nullish ( ) ,
19
19
followers : z . number ( ) . nullish ( ) ,
20
20
following : z . number ( ) . nullish ( ) ,
21
- } ) . transform ( ( { login, isHubber, msft_alias, ...rest } ) => ( {
21
+ } ) . transform ( ( { login, isHubber, msft_alias, ...rest } : { login : string , isHubber : string , msft_alias : string | null , [ key : string ] : any } ) => ( {
22
22
isHubber,
23
23
...rest
24
24
} ) ) ;
@@ -46,12 +46,12 @@ async function getHubberInfo(handle: string, token: string) {
46
46
return "user not found."
47
47
}
48
48
49
- const [ publicProfile , orgAllProfiles ] = await Promise . all ( [
49
+ const [ publicProfile , orgAllProfiles ] : [ any , any ] = await Promise . all ( [
50
50
profileResponse . json ( ) ,
51
51
orgChartResponse . json ( )
52
52
] ) ;
53
53
54
- const orgProfile = orgAllProfiles . find ( ( user : string ) => user . github_login === handle ) || { } ;
54
+ const orgProfile = orgAllProfiles . find ( ( user : { github_login : string } ) => user . github_login === handle ) || { } ;
55
55
const isHubber = ! ! orgProfile . github_login
56
56
57
57
const profileRaw = {
@@ -105,7 +105,7 @@ Bun.serve({
105
105
106
106
// get first word of the message
107
107
const firstWord = input . messages [ input . messages . length - 1 ] . content . split ( " " ) [ 0 ] ;
108
- const hubber = await getHubberInfo ( firstWord , request . headers . get ( "X-GitHub-Token" ) ) ;
108
+ const hubber = await getHubberInfo ( firstWord , request . headers . get ( "X-GitHub-Token" ) as any ) ;
109
109
110
110
const messages = input . messages ;
111
111
0 commit comments