#![allow(unused)]
use std::collections::HashMap;
use py_rs::PY;
#[derive(PY)]
#[py(export, export_to = "issue_168/")]
pub struct Foo {
map: HashMap<usize, Bar>,
}
#[derive(PY)]
#[py(export, export_to = "issue_168/")]
pub struct FooInlined {
#[py(inline)]
map: HashMap<usize, Bar>,
}
#[derive(PY)]
#[py(export, export_to = "issue_168/")]
struct Bar {
#[py(inline)]
map: HashMap<usize, Baz>,
}
#[derive(PY)]
#[py(export, export_to = "issue_168/")]
struct Baz {
#[py(inline)]
map: HashMap<usize, String>,
}
#[test]
#[cfg(not(feature = "import-esm"))]
fn issue_168() {
assert_eq!(
FooInlined::export_to_string().unwrap(),
"// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\
\n\
export type FooInlined = { map: { [key in number]?: { map: { [key in number]?: { map: { [key in number]?: string }, } }, } }, };\n"
);
assert_eq!(
Foo::export_to_string().unwrap(),
"// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\
import type { Bar } from \"./Bar\";\n\
\n\
export type Foo = { map: { [key in number]?: Bar }, };\n"
);
}