jhugman / uniffi-bindgen-react-native

A uniffi bindings generator for calling Rust from react-native
https://jhugman.github.io/uniffi-bindgen-react-native/
Other
52 stars 6 forks source link

Missing type designation on some imports from inter-crate dependencies for *Interface types #81

Closed zzorba closed 2 months ago

zzorba commented 2 months ago

In the matrix-rust-sdk, the matrix-sdk-ffi crate depends on the matrix-sdk crate for some types. When it imports, it is generating the following code:

import {
  type RoomPowerLevelChanges,
  BackupDownloadStrategy,
  OidcAuthorizationDataInterface,
  RoomMemberRole,
} from './matrix_sdk';

The issue is, that third item, OidcAuthorizationDataInterface is a type and not a class, and typescript does not like it. Strangely, RoomPowerLevelChanges is being imported correctly as a type, but the *Interface is not.

Here is the rust code that produces that type, if that is useful for debugging.

#[derive(Debug, Clone)]
#[cfg_attr(feature = "uniffi", derive(uniffi::Object))]
pub struct OidcAuthorizationData {
    /// The URL that should be presented.
    pub url: Url,
    /// A unique identifier for the request, used to ensure the response
    /// originated from the authentication issuer.
    pub state: String,
}