Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion macros/src/types/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) fn empty_object(attr: &StructAttr, ts_name: Expr) -> DerivedTS {

DerivedTS {
crate_rename: crate_rename.clone(),
inline: quote!("Record<string, never>".to_owned()),
inline: quote!("Record<symbol, never>".to_owned()),
inline_flattened: None,
docs: attr.docs.clone(),
dependencies: Dependencies::new(crate_rename),
Expand Down
18 changes: 9 additions & 9 deletions ts-rs/tests/integration/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ fn export_c() {
C::export().unwrap();

let expected_content = concat!(
"// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\n",
"/**\n",
" * Doc comment.\n",
" * Supports new lines.\n",
" *\n",
" * Testing\n",
" */\n",
"export type C = Record<string, never>;\n",
);
"// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\n",
"/**\n",
" * Doc comment.\n",
" * Supports new lines.\n",
" *\n",
" * Testing\n",
" */\n",
"export type C = Record<symbol, never>;\n",
);

let actual_content = fs::read_to_string(C::default_output_path().unwrap()).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions ts-rs/tests/integration/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ts_rs::TS;
struct Unit;

// serde_json serializes this to `{}`.
// The TS type best describing an empty object is `Record<string, never>`.
// The TS type best describing an empty object is `Record<symbol, never>`.
#[derive(TS)]
#[ts(export, export_to = "unit/")]
struct Unit2 {}
Expand All @@ -25,7 +25,7 @@ struct Unit4(());
#[test]
fn test() {
assert_eq!("type Unit = null;", Unit::decl());
assert_eq!("type Unit2 = Record<string, never>;", Unit2::decl());
assert_eq!("type Unit2 = Record<symbol, never>;", Unit2::decl());
assert_eq!("type Unit3 = never[];", Unit3::decl());
assert_eq!("type Unit4 = null;", Unit4::decl());
}