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: _blogposts/2024-02-01-release-11-1-0.mdx
+38-1
Original file line number
Diff line number
Diff line change
@@ -174,6 +174,43 @@ var result2 = JSON.stringify(obj, undefined, 2);
174
174
```
175
175
</CodeTab>
176
176
177
+
## %todo and warn-error
178
+
179
+
Inspired by languages like [Elm](https://package.elm-lang.org/packages/elm/core/latest/Debug#todo) or [Gleam](https://tour.gleam.run/advanced-features/todo/), we introduced a new extension point: [`%todo`](/syntax-lookup#todo).
180
+
181
+
It is used to tell the compiler that some code still needs to be implemented and it will crash when exectuted.
182
+
183
+
<CodeTab labels={["ReScript", "JS Output"]}>
184
+
185
+
```res
186
+
letimplementMeLater= ():string=>%todo("This should return a string eventually.")
187
+
188
+
letx=implementMeLater()
189
+
190
+
Console.log(x->String.includes("x"))
191
+
```
192
+
193
+
```js
194
+
varJs_exn=require("./stdlib/js_exn.js");
195
+
196
+
function implementMeLater() {
197
+
returnJs_exn.raiseError("playground.res:1:37-42 - Todo: This should return a string eventually.");
198
+
}
199
+
200
+
varx=Js_exn.raiseError("playground.res:1:37-42 - Todo: This should return a string eventually.");
201
+
202
+
console.log(x.includes("x"));
203
+
```
204
+
205
+
</CodeTab>
206
+
207
+
We also made the compiler's `-warn-error` flag accessible by the build system, so that `%todo`s and other warnings can be turned into errors in production builds.
208
+
209
+
```sh
210
+
rescript-warn-error+110
211
+
```
212
+
213
+
See ["Compile with stricter errors in CI"](/docs/manual/latest/build-overview#compile-with-stricter-errors-in-ci).
177
214
178
215
## Other changes
179
216
@@ -187,7 +224,7 @@ v11.1 marks the completion of the v11 versions feature wise. We will of course c
187
224
188
225
Once again we want to thank everyone from the community who volunteered their precious time to support this project with contributions of any kind, from documentation, to PRs, to discussions in the forum. But especially we want to thank the following people, who helped landing this release:
0 commit comments