Skip to content

Commit adeb6d0

Browse files
committed
docs: fix misleading example
1 parent 8834a43 commit adeb6d0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

pure-notation-spec.md

+4-10
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ The `#__PURE__` notation is a special comment syntax used by JavaScript bundlers
99
The `#__PURE__` notation is used as a comment in JavaScript code and should be placed immediately before the function or expression it refers to. The notation follows the `#__PURE__` or the `@__PURE__` keyword, enclosed within double underscores and double hashes.
1010

1111
```javascript
12-
/*#__PURE__*/
13-
function pureFunction() {
14-
// Function code here
15-
}
16-
17-
/* @__PURE__ */
18-
var pureExpression = someValue;
12+
let pureExpression = /* @__PURE__ */ inPureFunction();
1913
```
2014

2115
## Semantics
@@ -38,7 +32,7 @@ To mark a specific expression or assignment as pure, place the `#__PURE__` or `@
3832

3933
```javascript
4034
/* #__PURE__ */
41-
var pureExpression = pureOperation();
35+
let pureExpression = pureOperation();
4236
```
4337

4438
### 2. Inline Annotation
@@ -47,8 +41,8 @@ In some cases, it may be necessary to annotate a specific line of code within a
4741

4842
```javascript
4943
function impureFunction() {
50-
var result = /*#__PURE__*/ expensiveOperation(); // Inline annotation
51-
// Function code here
44+
let result = /*#__PURE__*/ expensiveOperation(); // Inline annotation
45+
// Function code here
5246
}
5347
```
5448

0 commit comments

Comments
 (0)