mirror of
https://github.com/xazukx/ts-rs.git
synced 2026-08-23 12:58:33 +00:00
34 lines
683 B
Rust
34 lines
683 B
Rust
#![allow(dead_code)]
|
|
|
|
use std::collections::{BTreeSet, HashSet};
|
|
|
|
use ts_rs::TS;
|
|
|
|
#[derive(TS, Eq, PartialEq, Hash)]
|
|
#[ts(export, export_to = "hashset/")]
|
|
struct CustomValue;
|
|
|
|
#[derive(TS)]
|
|
#[ts(export, export_to = "hashset/")]
|
|
struct HashSetWithCustomType {
|
|
set: HashSet<CustomValue>,
|
|
}
|
|
|
|
#[derive(TS)]
|
|
#[ts(export, export_to = "hashset/")]
|
|
struct BTreeSetWithCustomType {
|
|
set: BTreeSet<CustomValue>,
|
|
}
|
|
|
|
#[test]
|
|
fn with_custom_types() {
|
|
assert_eq!(
|
|
HashSetWithCustomType::inline(),
|
|
BTreeSetWithCustomType::inline()
|
|
);
|
|
assert_eq!(
|
|
HashSetWithCustomType::decl(),
|
|
"type HashSetWithCustomType = { set: Array<CustomValue>, };"
|
|
);
|
|
}
|