Repository navigation
Translate char to number in genType - #8988
Conversation
Why:
`char` is an alias of `int` since #8892, but genType's table of builtin
types had no row for it and does not expand the abbreviation, so a
`char` in a genType signature was emitted as the TypeScript type `char`,
which does not exist.
Representation modified (genType's TypeScript type of char):
Example:
@Gentype
let char0 = (x: char) => x
Before (text): export const char0: (x:char) => char = CoreJS.char0 as any;
After (text): export const char0: (x:number) => number = CoreJS.char0 as any;
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe
Semantic Diff1 commit · Full page Translate char to number in genType7427a92 · Christoph Knittel with Claude Opus 5.5 · Oct 23, 2026
Representation modified (genType's TypeScript type of char) @genType
let char0 = (x: char) => x
-export const char0: (x:char) => char = CoreJS.char0 as any;
+export const char0: (x:number) => number = CoreJS.char0 as any; |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8988 +/- ##
=======================================
Coverage 81.22% 81.22%
=======================================
Files 457 457
Lines 63862 63862
=======================================
Hits 51875 51875
Misses 11987 11987
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-8988 |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7427a92004
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Fixes #8975.
@genType let f = (c: char) => cgeneratedexport const f: (c:char) => char, andcharis not a TypeScript type. Since #8892,charis an alias ofint, but genType's builtin table intranslate_type_expr_from_types.mlmapped onlybool,int,floatandstring. ItsTconstrcase doesn't expand abbreviations, socharfell through to a type reference namedchar.charnow maps tonumber, likeint.Tests
typescript-react-example/src/Core.resgainschar0 = (x: char) => x. The generatedCore.gen.tsxhas(x:number) => number, andyarn typecheckchecks it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xk6AeCYpCK4SZRtHYKHGoe