@barefootjs/cli 0.19.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/core/advanced/error-codes.md +38 -0
- package/dist/index.js +811 -391
- package/package.json +4 -4
|
@@ -163,6 +163,44 @@ const byPrice = (a, b) => a.price - b.price
|
|
|
163
163
|
))}
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
#### Host rich-typed prop method calls (#2273)
|
|
167
|
+
|
|
168
|
+
**Trigger:** A method call on a prop provably typed as a built-in host rich
|
|
169
|
+
type — `Date`, `Map`, `Set`, `WeakMap`, `WeakSet`, `URL`, `URLSearchParams`,
|
|
170
|
+
`RegExp`, `Promise`, `Error`, `Symbol`, `BigInt`, `Function` — with no
|
|
171
|
+
catalogued lowering.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
// ❌ BF021 — Date.prototype.toISOString has no catalogued lowering
|
|
175
|
+
function Post({ createdAt }: { createdAt: Date }) {
|
|
176
|
+
return <div>{createdAt.toISOString()}</div>
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The receiver's type must be provable from the component's declared props
|
|
181
|
+
(destructured prop, `props.x` member chain, loop item field, `Date | null`
|
|
182
|
+
union) — an untyped, generic, or call-result receiver (`d().toISOString()`
|
|
183
|
+
where `d` is a signal) has no evidence and is not flagged.
|
|
184
|
+
|
|
185
|
+
#### Workaround
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
// ✅ Defer to the client
|
|
189
|
+
{/* @client */ createdAt.toISOString()}
|
|
190
|
+
|
|
191
|
+
// ✅ Or format in the backend and pass a string prop
|
|
192
|
+
function Post({ createdAt }: { createdAt: string }) {
|
|
193
|
+
return <div>{createdAt}</div>
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The string-prop variant moves the formatting to where full language power
|
|
198
|
+
already exists — the backend that populates the template data (Go handler,
|
|
199
|
+
Rails controller, …) formats the `Date` and passes the finished string. Note
|
|
200
|
+
that a component-body local (`const iso = createdAt.toISOString()`) is NOT a
|
|
201
|
+
workaround: it lowers to a template variable whose value the template
|
|
202
|
+
backend cannot compute, and dies at render time the same way.
|
|
203
|
+
|
|
166
204
|
### BF023 — Missing Key in List
|
|
167
205
|
|
|
168
206
|
**Trigger:** `.map()` loop without `key` prop.
|