@@ -20,7 +20,7 @@ fn get_string(device: &nusb::Device, index: Option<std::num::NonZeroU8>) -> Opti
2020 }
2121}
2222
23- #[ napi( object, js_name = "USBEndpoint" ) ]
23+ #[ napi( object) ]
2424pub struct UsbEndpoint {
2525 #[ napi( writable = false ) ]
2626 pub endpointNumber : u8 ,
@@ -52,7 +52,7 @@ impl UsbEndpoint {
5252 }
5353}
5454
55- #[ napi( object, js_name = "USBAlternateInterface" ) ]
55+ #[ napi( object) ]
5656pub struct UsbAlternateInterface {
5757 #[ napi( writable = false ) ]
5858 pub alternateSetting : u8 ,
@@ -81,7 +81,7 @@ impl UsbAlternateInterface {
8181 }
8282}
8383
84- #[ napi( object, js_name = "USBInterface" ) ]
84+ #[ napi( object) ]
8585pub struct UsbInterface {
8686 #[ napi( writable = false ) ]
8787 pub interfaceNumber : u8 ,
@@ -104,7 +104,7 @@ impl UsbInterface {
104104 }
105105}
106106
107- #[ napi( object, js_name = "USBConfiguration" ) ]
107+ #[ napi( object) ]
108108pub struct UsbConfiguration {
109109 #[ napi( writable = false ) ]
110110 pub configurationValue : u8 ,
@@ -270,7 +270,7 @@ impl UsbDevice {
270270 self . device . is_some ( )
271271 }
272272
273- #[ napi( getter) ]
273+ #[ napi( getter, ts_return_type = "USBConfiguration" ) ]
274274 pub unsafe fn configuration ( & mut self ) -> Option < UsbConfiguration > {
275275 let device = match self . device . as_ref ( ) {
276276 Some ( device) => device. clone ( ) ,
@@ -280,7 +280,7 @@ impl UsbDevice {
280280 Some ( UsbConfiguration :: new ( & self , & device, device. active_configuration ( ) . unwrap ( ) ) )
281281 }
282282
283- #[ napi( getter) ]
283+ #[ napi( getter, ts_return_type = "Array<USBConfiguration>" ) ]
284284 pub unsafe fn configurations ( & mut self ) -> Vec < UsbConfiguration > {
285285 let device = match self . device . as_ref ( ) {
286286 Some ( device) => device. clone ( ) ,
@@ -499,12 +499,12 @@ impl UsbDevice {
499499 }
500500 }
501501
502- #[ napi( ts_return_type = "Promise<USBIsochronousInTransferResult>" ) ]
502+ #[ napi( js_name = "nativeIsochronousTransferIn" , ts_return_type = "Promise<USBIsochronousInTransferResult>" ) ]
503503 pub async fn isochronousTransferIn ( & self , _endpointNumber : u8 , _packetLengths : Vec < u32 > ) -> Result < ( ) > {
504504 Err ( napi:: Error :: from_reason ( "isochronousTransferIn error: method not implemented" ) )
505505 }
506506
507- #[ napi( ts_return_type = "Promise<USBIsochronousOutTransferResult>" ) ]
507+ #[ napi( js_name = "nativeIsochronousTransferOut" , ts_return_type = "Promise<USBIsochronousOutTransferResult>" ) ]
508508 pub async fn isochronousTransferOut ( & self , _endpointNumber : u8 , _data : Uint8Array , _packetLengths : Vec < u32 > ) -> Result < ( ) > {
509509 Err ( napi:: Error :: from_reason ( "isochronousTransferOut error: method not implemented" ) )
510510 }
0 commit comments