You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,24 @@
1
1
# master
2
+
### Breaking
3
+
### Features
4
+
### Fixes
5
+
6
+
# 12.0.0
7
+
### Breaking
8
+
- Change generated type of unit structs to `Record<symbol, never>` ([#431](https://github.com/Aleph-Alpha/ts-rs/pull/431))
9
+
- Change generated type of `HashMap` to `{ [key in K]: V }` if `K` is not an enum ([#446](https://github.com/Aleph-Alpha/ts-rs/pull/446))
10
+
- Enable programmatic configuration of binding generation ([#460](https://github.com/Aleph-Alpha/ts-rs/pull/460))
11
+
2
12
### Features
3
13
- Add `TS_RS_LARGE_INT` environment variable to configure binding for `i64`, `u64`, `i128`, etc. ([#448](https://github.com/Aleph-Alpha/ts-rs/pull/448))
14
+
- Add support for `arrayvec` ([#469](https://github.com/Aleph-Alpha/ts-rs/pull/469))
15
+
- Add support for `jiff` ([#458](https://github.com/Aleph-Alpha/ts-rs/pull/458))
4
16
5
17
### Fixes
18
+
- Do not emit warning for `#[serde(borrow)]` ([#471](https://github.com/Aleph-Alpha/ts-rs/pull/471))
6
19
- Do not emit warning for `#[serde(crate = "..")]` ([#447](https://github.com/Aleph-Alpha/ts-rs/pull/447))
7
20
- Fix trait bound generation when using `#[ts(optional)]` on an `Option<Generic>` ([#454](https://github.com/Aleph-Alpha/ts-rs/pull/454))
21
+
- Fix parsing of comma-separated serde attributes ([#466](https://github.com/Aleph-Alpha/ts-rs/pull/466))
| serde-compat |**Enabled by default** <br/>See the *"serde compatibility"* section below for more information. |
81
-
| format | Enables formatting of the generated TypeScript bindings. <br/>Currently, this unfortunately adds quite a few dependencies. |
82
-
| no-serde-warnings | By default, warnings are printed during build if unsupported serde attributes are encountered. <br/>Enabling this feature silences these warnings. |
83
-
| serde-json-impl | Implement `TS` for types from *serde_json*|
84
-
| chrono-impl | Implement `TS` for types from *chrono*|
85
-
| bigdecimal-impl | Implement `TS` for types from *bigdecimal*|
86
-
| url-impl | Implement `TS` for types from *url*|
87
-
| uuid-impl | Implement `TS` for types from *uuid*|
88
-
| bson-uuid-impl | Implement `TS` for *bson::oid::ObjectId* and *bson::uuid*|
89
-
| bytes-impl | Implement `TS` for types from *bytes*|
90
-
| indexmap-impl | Implement `TS` for types from *indexmap*|
91
-
| ordered-float-impl | Implement `TS` for types from *ordered_float*|
92
-
| heapless-impl | Implement `TS` for types from *heapless*|
93
-
| semver-impl | Implement `TS` for types from *semver*|
94
-
| smol_str-impl | Implement `TS` for types from *smol_str*|
95
-
| tokio-impl | Implement `TS` for types from *tokio*|
96
-
| jiff-impl | Implement `TS` for types from *jiff*|
97
-
| arrayvec-impl | Implement `TS` for types from *arrayvec*|
98
-
99
-
<br/>
70
+
- precise control over generated types
100
71
101
-
If there's a type you're dealing with which doesn't implement `TS`, use either
102
-
`#[ts(as = "..")]` or `#[ts(type = "..")]`, or open a PR.
103
-
104
-
### `serde` compatability
105
-
With the `serde-compat` feature (enabled by default), serde attributes can be parsed for enums and structs.
106
-
Supported serde attributes:
107
-
-`rename`
108
-
-`rename-all`
109
-
-`rename-all-fields`
110
-
-`tag`
111
-
-`content`
112
-
-`untagged`
113
-
-`skip`
114
-
-`skip_serializing`
115
-
-`skip_serializing_if`
116
-
-`flatten`
117
-
-`default`
118
-
119
-
Note: `skip_serializing` and `skip_serializing_if` only have an effect when used together with
120
-
`#[serde(default)]`.
121
-
122
-
Note: `skip_deserializing` is ignored. If you wish to exclude a field
123
-
from the generated type, but cannot use `#[serde(skip)]`, use `#[ts(skip)]` instead.
72
+
If there's a type you're dealing with which doesn't implement `TS`, you can use either
73
+
`#[ts(as = "..")]` or `#[ts(type = "..")]`, enable the appropriate cargo feature, or open a PR.
124
74
125
-
When ts-rs encounters an unsupported serde attribute, a warning is emitted, unless the feature `no-serde-warnings` is enabled.
126
-
127
-
### Environment variables
75
+
### Configuration
76
+
When using `#[ts(export)]` on a type, `ts-rs` generates a test which writes the bindings for it to disk.\
77
+
The following environment variables may be set to configure *how* and *where*:
|`TS_RS_EXPORT_DIR`| Base directory into which bindings will be exported |`./bindings`|
131
81
|`TS_RS_IMPORT_EXTENSION`| File extension used in `import` statements |*none*|
132
82
|`TS_RS_LARGE_INT`| Binding used for large integer types (`i64`, `u64`, `i128`, `u128`) |`bigint`|
133
83
84
+
We recommend putting this configuration in the project's [config.toml](https://doc.rust-lang.org/cargo/reference/config.html#env) to make it persistent:
85
+
```toml
86
+
# <project-root>/.cargo/config.toml
87
+
[env]
88
+
TS_RS_EXPORT_DIR = { value = "bindings", relative = true }
89
+
TS_RS_LARGE_INT = "number"
90
+
```
91
+
92
+
To export bindings programmatically without the use of tests, `TS::export_all`, `TS::export`, and `TS::export_to_string` can be used instead.
93
+
94
+
### Serde Compatibility
95
+
With the `serde-compat` feature (enabled by default), serde attributes are parsed for enums and structs.\
| serde-compat |**Enabled by default** <br/>See the *"serde compatibility"* section below for more information. |
111
+
| format | Enables formatting of the generated TypeScript bindings. <br/>Currently, this unfortunately adds quite a few dependencies. |
112
+
| no-serde-warnings | By default, warnings are printed during build if unsupported serde attributes are encountered. <br/>Enabling this feature silences these warnings. |
113
+
| serde-json-impl | Implement `TS` for types from *serde_json*|
114
+
| chrono-impl | Implement `TS` for types from *chrono*|
115
+
| bigdecimal-impl | Implement `TS` for types from *bigdecimal*|
116
+
| url-impl | Implement `TS` for types from *url*|
117
+
| uuid-impl | Implement `TS` for types from *uuid*|
118
+
| bson-uuid-impl | Implement `TS` for *bson::oid::ObjectId* and *bson::uuid*|
119
+
| bytes-impl | Implement `TS` for types from *bytes*|
120
+
| indexmap-impl | Implement `TS` for types from *indexmap*|
121
+
| ordered-float-impl | Implement `TS` for types from *ordered_float*|
122
+
| heapless-impl | Implement `TS` for types from *heapless*|
123
+
| semver-impl | Implement `TS` for types from *semver*|
124
+
| smol_str-impl | Implement `TS` for types from *smol_str*|
125
+
| tokio-impl | Implement `TS` for types from *tokio*|
126
+
| jiff-impl | Implement `TS` for types from *jiff*|
127
+
| arrayvec-impl | Implement `TS` for types from *arrayvec*|
0 commit comments