Commit f29aa1e
fix(durable-functions): thread entity state type through EntityContext<TState>
The v3-compat EntityContext<TState>/EntityHandler<TState> aliases accepted a
state type parameter but ignored it, so a bare context.df.getState() returned
unknown. Genuine v3 entity code (e.g. the ported BasicNode ClassBasedEntities
sample) relies on getState() returning the context's TState, so it failed to
compile against the compat package.
Make DurableEntityContext generic over TState and default the getState<T = TState>
method generic to it, so a bare getState() returns TState | undefined (matching
v3) while an explicit getState<X>() still overrides. Because TState only appears
as an erased method-generic default, DurableEntityContext<A> and <B> stay
structurally identical, so app.entity() registration still accepts specifically
typed handlers (verified: full compat unit suite green).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6e5be22b-b727-4ccf-8668-60397bb403a01 parent 2982f34 commit f29aa1e
3 files changed
Lines changed: 20 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | | - | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
109 | | - | |
110 | | - | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
116 | 120 | | |
117 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
0 commit comments