Commit 6be559a
chore: don't redeclare inherited observable Session.name (#34034)
* fix: don't redeclare inherited observable Session.name
`Session extends Instrument` (Log), which declares `name` and converts it to a
MobX observable in its constructor. `Session` redeclared `name: string` only to
narrow the type, but under `useDefineForClassFields: true` that subclass field's
define-semantics initializer runs after `super()` and re-defines the property
MobX already installed — throwing `TypeError: Cannot redefine property: name`
when a Session model is constructed (surfaces in the test-replay viewer's
esbuild bundle, which emits the field; the app's babel build erased it).
Removing the redeclaration (rather than using `declare`, which the app's babel
class-properties pipeline can't strip) fixes it for both build pipelines.
`name` is only assigned in Session, never read, so the inherited type suffices.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Apply suggestion from @ryanthemanuel
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 437a08e commit 6be559a
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
0 commit comments