Commit 32691fd
fix(stdlib): align Json.getCases return type with Python output (#279)
The F# return type `string array` for `getCases` was inaccurate — Fable
union types' `cases()` static method returns `list[str]`, not an
FSharpArray. Pyright flagged the resulting `cases: Array[str] = ...`
assignment as a type error in the generated Python (issue #278).
Change the return type to `ResizeArray<string>` (which maps to Python
`list`) and update the call site to use `.Count` instead of `.Length`.
Both compile to `len(...)` so runtime behavior is unchanged.
Also wire up pyright in CI to catch future regressions: add a `just
pyright` recipe scoped to `build/stdlib`, run it in the build-and-test
workflow, and bump pyright to 1.1.409. Fable codegen-artifact rules
(`reportUnusedImport`, `reportInvalidTypeVarUse`) are disabled since
those are emitted by the compiler, not the bindings.
Closes #278
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0639c9a commit 32691fd
5 files changed
Lines changed: 45 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
48 | 51 | | |
49 | 52 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| |||
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | | - | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments