Skip to content

Commit

Permalink
File header docs + minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
oscartbeaumont committed Jun 2, 2024
1 parent c7878ec commit 9f36820
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion docs/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ You can do that like the following:

```rust
let builder = ts::builder()
// < your commands and events are probally here
// < your commands and events are probaly here
.types(TypeCollection::default().register::<Custom>()); // < call `register` as much as you want.
```

Expand All @@ -193,3 +193,13 @@ export ... = {};
```

Any type implemented using the [`Type`](https://docs.rs/specta/latest/specta/derive.Type.html) derive macro will meet this requirement.

## File header

It's very common that your are using a linting or formatting tool on your codebase and it's likely that the output of Tauri Specta will not match your style. You can configure the header of the file like the following to solve this:

```rust
let builder = ts::builder()
// < your commands and events are probally here
.header("// @ts-nocheck");
```
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ where
let rendered = TLang::render(&commands, &events, &type_map, &config)?;

Ok((
format!("{}{rendered}", &config.header),
format!("{}\n{rendered}", &config.header),
(invoke_handler, events_registry),
))
}
Expand Down

0 comments on commit 9f36820

Please sign in to comment.