Skip to content

fix(napi-derive): generate correct types for HashMap with RandomState argument#2384

Merged
Brooooooklyn merged 2 commits into
napi-rs:mainfrom
sapphi-red:fix/generate-correct-types-for-hashmap-with-random-state
Dec 2, 2024
Merged

fix(napi-derive): generate correct types for HashMap with RandomState argument#2384
Brooooooklyn merged 2 commits into
napi-rs:mainfrom
sapphi-red:fix/generate-correct-types-for-hashmap-with-random-state

Conversation

@sapphi-red
Copy link
Copy Markdown
Contributor

For

#[napi]
fn get_mapping_with_hasher() -> HashMap<String, u32, FxBuildHasher> {
  let mut map = HashMap::with_hasher(FxBuildHasher);
  map.insert("a".to_string(), 101);
  map.insert("b".to_string(), 102);
  map
}

the following types were generated

export declare function getIndexMappingWithHasher(): any

This PR fixes that.

@Brooooooklyn Brooooooklyn merged commit 6a4ce68 into napi-rs:main Dec 2, 2024
@sapphi-red sapphi-red deleted the fix/generate-correct-types-for-hashmap-with-random-state branch December 11, 2024 07:07
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