chore (macro-rs): add for_ts macro

This commit is contained in:
naskya 2024-07-30 23:06:34 +09:00
parent 6344b72321
commit e28389ed88
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
5 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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)
}

View file

@ -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]

View file

@ -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"]

View file

@ -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
///