chore (macro-rs): add for_ts macro
This commit is contained in:
parent
6344b72321
commit
e28389ed88
5 changed files with 9 additions and 9 deletions
2
packages/backend-rs/index.d.ts
vendored
2
packages/backend-rs/index.d.ts
vendored
|
@ -1291,7 +1291,7 @@ export type RelayStatus = 'accepted'|
|
|||
/** Delete all entries in the [attestation_challenge] table created at more than 5 minutes ago */
|
||||
export declare function removeOldAttestationChallenges(): Promise<void>
|
||||
|
||||
export declare function renderAccept(userId: string, followObject: Follow): ApAccept
|
||||
export declare function renderAccept(userId: string, followObject: ApFollow): ApAccept
|
||||
|
||||
export declare function renderEmoji(emoji: Emoji): ApEmoji
|
||||
|
||||
|
|
|
@ -24,10 +24,7 @@ impl ApAccept {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(test, doctest, feature = "napi"))]
|
||||
type Follow = follow::ApFollow;
|
||||
|
||||
#[macros::ts_export]
|
||||
pub fn render_accept(user_id: String, follow_object: Follow) -> ApAccept {
|
||||
pub fn render_accept(user_id: String, follow_object: follow::ApFollow) -> ApAccept {
|
||||
ApAccept::new(user_id, follow_object)
|
||||
}
|
||||
|
|
|
@ -40,9 +40,7 @@ impl ApEmoji {
|
|||
}
|
||||
}
|
||||
|
||||
// for napi export
|
||||
// https://github.com/napi-rs/napi-rs/issues/2060
|
||||
#[allow(dead_code)] // TODO: remove this line
|
||||
#[macros::for_ts] // https://github.com/napi-rs/napi-rs/issues/2060
|
||||
type Emoji = emoji::Model;
|
||||
|
||||
#[macros::ts_export]
|
||||
|
|
|
@ -152,7 +152,7 @@ pub async fn nodeinfo_2_0() -> Result<Nodeinfo20, DbErr> {
|
|||
Ok(nodeinfo_2_1().await?.into())
|
||||
}
|
||||
|
||||
#[cfg(any(test, doctest, feature = "napi"))]
|
||||
#[macros::for_ts]
|
||||
#[macros::errors]
|
||||
pub enum Error {
|
||||
#[doc = "database error"]
|
||||
|
|
|
@ -76,6 +76,11 @@ define_wrapper_proc_macro_attributes! {
|
|||
#item
|
||||
}
|
||||
|
||||
for_ts(_attr, item) {
|
||||
#[cfg(any(test, doctest, feature = "napi"))]
|
||||
#item
|
||||
}
|
||||
|
||||
/// When applied to enums, this macro implements [`std::error::Error`] trait
|
||||
/// and generates a document based on error messages unless there is already a doc comment
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue