@@ -30,11 +30,11 @@ function nodeJsModernExample() {
3030 const response = await api . request ( "GET /users/{id}" , {
3131 params : { id } ,
3232 } ) ;
33-
33+
3434 console . log ( "User data:" , response . data ) ;
3535 console . log ( "Response status:" , response . status ) ;
3636 console . log ( "Content-Type:" , response . headers . get ( "content-type" ) ) ;
37-
37+
3838 return response . data ;
3939 } ,
4040 } ;
@@ -46,7 +46,7 @@ function nodeJsModernExample() {
4646async function nodeJsCustomFetchExample ( ) {
4747 // For Node.js < 18 or custom fetch implementation
4848 const { default : nodeFetch } = await import ( "node-fetch" ) ;
49-
49+
5050 const client = new TypeFetcher ( {
5151 baseURL : "https://jsonplaceholder.typicode.com" ,
5252 fetch : nodeFetch as unknown as typeof globalThis . fetch ,
@@ -66,7 +66,7 @@ async function nodeJsCustomFetchExample() {
6666 const response = await api . request ( "GET /users/{id}" , {
6767 params : { id } ,
6868 } ) ;
69-
69+
7070 return {
7171 user : response . data ,
7272 status : response . status ,
@@ -82,7 +82,7 @@ async function nodeJsCustomFetchExample() {
8282async function nodeJsUndiciExample ( ) {
8383 // Using undici as fetch implementation
8484 const { fetch } = await import ( "undici" ) ;
85-
85+
8686 const client = new TypeFetcher ( {
8787 baseURL : "https://jsonplaceholder.typicode.com" ,
8888 fetch : fetch as unknown as typeof globalThis . fetch ,
@@ -93,13 +93,13 @@ async function nodeJsUndiciExample() {
9393 return {
9494 async getUsers ( ) {
9595 const response = await api . request ( "GET /users" ) ;
96-
97- console . log ( "Fetched" , response . data ?. length || 0 , "users" ) ;
96+
97+ console . log ( "Fetched" , ( response . data as any ) ?. length || 0 , "users" ) ;
9898 console . log ( "Response headers:" ) ;
9999 for ( const [ key , value ] of response . headers . entries ( ) ) {
100100 console . log ( ` ${ key } : ${ value } ` ) ;
101101 }
102-
102+
103103 return response . data ;
104104 } ,
105105 } ;
0 commit comments