Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix
Browse files Browse the repository at this point in the history
robertbastian committed Nov 22, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent eeef4bd commit bf65ee4
Showing 2 changed files with 6 additions and 11 deletions.
12 changes: 5 additions & 7 deletions tool/src/js/docs.rs
Original file line number Diff line number Diff line change
@@ -142,13 +142,11 @@ pub fn gen_method_docs<W: fmt::Write>(
writeln!(method_indented)?;
}

for p in method.params.iter().filter(|p| {
matches!(
p.ty,
ast::TypeName::PrimitiveSlice(..)
| ast::TypeName::StrReference(_, ast::StringEncoding::UnvalidatedUtf16)
)
}) {
for p in method
.params
.iter()
.filter(|p| matches!(p.ty, ast::TypeName::PrimitiveSlice(..)))
{
writeln!(
method_indented,
"- Note: ``{}`` should be an ArrayBuffer or TypedArray corresponding to the slice type expected by Rust.",
5 changes: 1 addition & 4 deletions tool/src/js/structs.rs
Original file line number Diff line number Diff line change
@@ -500,12 +500,9 @@ pub fn gen_ts_type<W: fmt::Write>(
return Ok(opt);
}
ast::TypeName::Writeable => unreachable!(),
ast::TypeName::StrReference(_, ast::StringEncoding::UnvalidatedUtf8) => {
ast::TypeName::StrReference(_, ast::StringEncoding::UnvalidatedUtf8 | ast::StringEncoding::UnvalidatedUtf16) => {
out.write_str("string")?
}
ast::TypeName::StrReference(_, ast::StringEncoding::UnvalidatedUtf16) => {
out.write_str("Uint16Array")?
}
ast::TypeName::PrimitiveSlice(.., prim) => match prim {
ast::PrimitiveType::i8 => write!(out, "Int8Array")?,
ast::PrimitiveType::u8 => write!(out, "Uint8Array")?,

0 comments on commit bf65ee4

Please sign in to comment.