Skip to content

Commit ae27c3f

Browse files
Syntax lookup: let \"" (rescript-lang#242)
* Syntax Lookup: let binding invalid * Update misc_docs/syntax/language_let_invalid.mdx Co-authored-by: Patrick Ecker <[email protected]>
1 parent d5e85b4 commit ae27c3f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: "let-binding-invalid"
3+
keywords: ["let", "variable"]
4+
name: "let \\\"\""
5+
summary: "This is the `let binding` for invalid identifier names."
6+
category: "languageconstructs"
7+
---
8+
9+
`let \""` is used to bind values to names that are invalid in ReScript, including capitalized names, names with special characters, and reserved keywords.
10+
11+
**Warning: ** This escape hatch is almost exclusively used for interop with JavaScript. If you abuse this, many of the compiler guarantees will go away.
12+
13+
### Example
14+
15+
<CodeTab labels={["ReScript", "JS Output"]}>
16+
17+
```res
18+
let \"ComponentName" = "Header"
19+
let \"min-width" = 640
20+
let \"exception" = true
21+
```
22+
23+
```js
24+
var ComponentName = "Header";
25+
var min$width = 640;
26+
var exception = true;
27+
```
28+
29+
</CodeTab>
30+
31+
### References
32+
33+
* [Use Illegal Identifier Names](/docs/manual/latest/use-illegal-identifier-names)
34+
* [Let binding](/docs/manual/latest/let-binding)
35+
* [Reserved Keywords](/docs/manual/latest/reserved-keywords)

0 commit comments

Comments
 (0)