Skip to content

Commit f51c32b

Browse files
committed
Fix optional shape value grammar
1 parent 4c3855e commit f51c32b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Specification/Section 4 -- Structural Types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ ParseException: Duplicate key "1"
119119

120120
An explicit field MAY be marked _optional_ by placing a question mark before
121121
the colon. An optional key (`key?: Type`) states that the field may be
122-
absent; this is distinct from an optional value (`key: Type?`), which states
122+
absent; this is distinct from an optional value (`key: ?Type`), which states
123123
that the field is always present but its value may be `null`.
124124

125125
```typescript
126126
array{ key?: Type }
127127
```
128128

129129
```typescript
130-
array{ key: Type? }
130+
array{ key: ?Type }
131131
```
132132
133133
### Unsealed Shapes

Writerside/cfg/static/spec.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,10 +1065,10 @@ <h3><span class="spec-secid" title="link to this section"><a href="#sec-Shape-Fi
10651065
</section>
10661066
<section id="sec-Optional-Fields" secid="6.1.2">
10671067
<h3><span class="spec-secid" title="link to this section"><a href="#sec-Optional-Fields">6.1.2</a></span>Optional Fields</h3>
1068-
<p>An explicit field MAY be marked <em>optional</em> by placing a question mark before the colon. An optional key (<code>key?: Type</code>) states that the field may be absent; this is distinct from an optional value (<code>key: Type?</code>), which states that the field is always present but its value may be <code>null</code>.</p>
1068+
<p>An explicit field MAY be marked <em>optional</em> by placing a question mark before the colon. An optional key (<code>key?: Type</code>) states that the field may be absent; this is distinct from an optional value (<code>key: ?Type</code>), which states that the field is always present but its value may be <code>null</code>.</p>
10691069
<pre data-language="typescript"><code>array<span class="token punctuation">{</span> key<span class="token operator">?</span><span class="token operator">:</span> Type <span class="token punctuation">}</span>
10701070
</code></pre>
1071-
<pre data-language="typescript"><code>array<span class="token punctuation">{</span> key<span class="token operator">:</span> Type<span class="token operator">?</span> <span class="token punctuation">}</span>
1071+
<pre data-language="typescript"><code>array<span class="token punctuation">{</span> key<span class="token operator">:</span> <span class="token operator">?</span>Type <span class="token punctuation">}</span>
10721072
</code></pre>
10731073
</section>
10741074
<section id="sec-Unsealed-Shapes" secid="6.1.3">

0 commit comments

Comments
 (0)