use stupidly large types in E2E test - maybe it fails on CI?

This commit is contained in:
Moritz Bischof
2024-02-01 18:52:33 +01:00
parent ab569e4447
commit 646ccd9520
4 changed files with 88 additions and 3 deletions
+1 -1
View File
@@ -2,5 +2,5 @@ use ts_rs::TS;
#[derive(TS)]
pub struct Crate1 {
pub x: i32
pub x: [[[i32; 128]; 128]; 128],
}
+1 -1
View File
@@ -2,5 +2,5 @@ use ts_rs::TS;
#[derive(TS)]
pub struct Crate2 {
pub x: i32
pub x: [[[i32; 128]; 128]; 128],
}
+84
View File
@@ -12,3 +12,87 @@ pub struct Parent {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent2 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent3 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent4 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent5 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent6 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent7 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent8 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent9 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent10 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent11 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent12 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent13 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent14 {
pub crate1: Crate1,
pub crate2: Crate2,
}
#[derive(TS)]
#[ts(export)]
pub struct Parent15 {
pub crate1: Crate1,
pub crate2: Crate2,
}
+2 -1
View File
@@ -31,6 +31,7 @@ pub enum ExportError {
/// Exports `T` to the file specified by the `#[ts(export_to = ..)]` attribute.
/// Additionally, all dependencies of `T` will be exported as well.
///
/// TODO: This might cause a race condition:
/// If two types `A` and `B` are `#[ts(export)]` and depend on type `C`,
/// then both tests for exporting `A` and `B` will try to write `C` to `C.ts`.
@@ -133,7 +134,7 @@ fn generate_decl<T: TS + ?Sized>(out: &mut String) {
/// Push an import statement for all dependencies of `T`
fn generate_imports<T: TS + ?Sized + 'static>(out: &mut String) -> Result<(), ExportError> {
let path =
Path::new(T::EXPORT_TO.ok_or(ExportError::CannotBeExported(std::any::type_name::<T>()))?);
Path::new(T::EXPORT_TO.ok_or(CannotBeExported(std::any::type_name::<T>()))?);
let deps = T::dependencies();
let deduplicated_deps = deps