Skip to content

fix(napi-derive-backend): should respect origin name for class factory#2280

Merged
Brooooooklyn merged 1 commit into
napi-rs:mainfrom
richerfu:main
Sep 30, 2024
Merged

fix(napi-derive-backend): should respect origin name for class factory#2280
Brooooooklyn merged 1 commit into
napi-rs:mainfrom
richerfu:main

Conversation

@richerfu

Copy link
Copy Markdown
Contributor

Fix generated code for class factory:

example:

use napi_derive::napi;

pub struct QueryEngine {}
 
#[napi(js_name = "QueryEngine")]
pub struct JSQueryEngine {
  engine: QueryEngine,
}
 
#[napi]
impl JSQueryEngine {
  #[napi(factory)]
  pub fn with_initial_count() -> Self {
    JSQueryEngine { engine: QueryEngine {} }
  }
}
export declare class QueryEngine {
  static withInitialCount(): JsQueryEngine
}
export type JSQueryEngine = QueryEngine

should be:

export declare class QueryEngine {
  static withInitialCount(): QueryEngine
}
export type JSQueryEngine = QueryEngine

@Brooooooklyn Brooooooklyn merged commit d3cf9cb into napi-rs:main Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants