Skip to content

Commit

Permalink
Deprecation code within a block and updated deprecation note
Browse files Browse the repository at this point in the history
  • Loading branch information
danielronnkvist committed Jan 13, 2025
1 parent 60c7b97 commit d0a68b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions crates/backend/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,11 @@ impl TryToTokens for ast::Export {
if self.function.r#async {
(quote_spanned! {
self.function.name_span =>
#[deprecated(note = "async constructors are not supported")]
fn constructor() {}
constructor();
const _: () = {
#[deprecated(note = "async constructors produce invalid TS code and support will be removed in the future")]
const fn constructor() {}
constructor();
};
})
.to_tokens(into);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/macro/ui-tests/unsupported-options.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
warning: use of deprecated function `RustStruct::new::{closure#0}::constructor`: async constructors are not supported
warning: use of deprecated function `RustStruct::new::{closure#0}::_::constructor`: async constructors produce invalid TS code and support will be removed in the future
--> ui-tests/unsupported-options.rs:15:18
|
15 | pub async fn new() -> Self {
Expand Down

0 comments on commit d0a68b6

Please sign in to comment.