Skip to content

Commit c86f3a0

Browse files
committed
Syntax lookup: Deprecated decorator
1 parent 059022e commit c86f3a0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
id: "deprecated-decorator"
3+
keywords: ["deprecated", "decorator"]
4+
name: "@deprecated"
5+
summary: "This is the `@deprecated` decorator."
6+
category: "decorators"
7+
---
8+
9+
The `@deprecated` decorator is used to annotate deprecated types and values. This may be used by ReScript tooling to highlight deprecated code during development.
10+
11+
### Example
12+
13+
<CodeTab labels={["ReScript", "JS Output"]}>
14+
15+
```res
16+
@deprecated
17+
type person = {id: int, name: string}
18+
19+
@deprecated
20+
let customDouble = foo => foo * 2
21+
22+
@deprecated("Use SomeOther.customTriple instead")
23+
let customTriple = foo => foo * 3
24+
```
25+
26+
```js
27+
function customDouble(foo) {
28+
return foo << 1;
29+
}
30+
31+
function customTriple(foo) {
32+
return Math.imul(foo, 3);
33+
}
34+
```
35+
36+
</CodeTab>
37+
38+

0 commit comments

Comments
 (0)