Skip to content

Commit a4fa47b

Browse files
Mention %dtodo and -warn-error
1 parent a084cbd commit a4fa47b

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

_blogposts/2024-02-01-release-11-1-0.mdx

+38-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,43 @@ var result2 = JSON.stringify(obj, undefined, 2);
174174
```
175175
</CodeTab>
176176
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+
let implementMeLater = (): string => %todo("This should return a string eventually.")
187+
188+
let x = implementMeLater()
189+
190+
Console.log(x->String.includes("x"))
191+
```
192+
193+
```js
194+
var Js_exn = require("./stdlib/js_exn.js");
195+
196+
function implementMeLater() {
197+
return Js_exn.raiseError("playground.res:1:37-42 - Todo: This should return a string eventually.");
198+
}
199+
200+
var x = 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).
177214
178215
## Other changes
179216
@@ -187,7 +224,7 @@ v11.1 marks the completion of the v11 versions feature wise. We will of course c
187224
188225
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:
189226
190-
[@cknitt](https://github.com/cknitt), [@cometkim](https://github.com/cometkim), [@cristianoc](https://github.com/cristianoc), [@diogomqbm](https://github.com/diogomqbm), [@enzo-pellegrini](https://github.com/enzo-pellegrini), [@glennsl](https://github.com/glennsl), [@JonoPrest](https://github.com/JonoPrest), [@mununki](https://github.com/mununki), [@kevinbarabash](https://github.com/kevinbarabash), [@shulhi](https://github.com/shulhi), [@tsnobip](https://github.com/tsnobip), [@zth](https://github.com/zth).
227+
[@cknitt](https://github.com/cknitt), [@cometkim](https://github.com/cometkim), [@cristianoc](https://github.com/cristianoc), [@diogomqbm](https://github.com/diogomqbm), [@enzo-pellegrini](https://github.com/enzo-pellegrini), [@fhammerschmidt](https://github.com/fhammerschmidt), [@glennsl](https://github.com/glennsl), [@JonoPrest](https://github.com/JonoPrest), [@mununki](https://github.com/mununki), [@kevinbarabash](https://github.com/kevinbarabash), [@shulhi](https://github.com/shulhi), [@tsnobip](https://github.com/tsnobip), [@zth](https://github.com/zth).
191228
192229
## That's it
193230

0 commit comments

Comments
 (0)