Commit 9e60c03
committed
refactor(spawn-node): use assertion function instead of structural cast
TypeScript can't narrow a parent object from a typeof-check on one of
its properties, which forced `spawnResult.process as { send: ... }`
downstream of the existing runtime guard. Extract the guard into a
small `assertHasSend` assertion function so the call site narrows
cleanly and the structural cast is gone.1 parent 65f0c72 commit 9e60c03
1 file changed
+21
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
36 | 52 | | |
37 | 53 | | |
38 | 54 | | |
| |||
117 | 133 | | |
118 | 134 | | |
119 | 135 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
125 | 140 | | |
126 | | - | |
| 141 | + | |
127 | 142 | | |
128 | 143 | | |
129 | 144 | | |
| |||
0 commit comments