Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/gentype-char-number.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- genType emits `char` as the TypeScript type `number` instead of `char`, which TypeScript does not know.
2 changes: 1 addition & 1 deletion compiler/gentype/translate_type_expr_from_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ let translate_constr ~config ~params_translation ~(path : Path.t) ~type_env =
in
match (path |> path_to_list |> List.rev, params_translation) with
| ["bool"], [] -> {dependencies = []; type_ = boolean_t}
| ["int"], [] -> {dependencies = []; type_ = number_t}
| (["int"] | ["char"]), [] -> {dependencies = []; type_ = number_t}
Comment thread
cknitt marked this conversation as resolved.
| ["float"], [] -> {dependencies = []; type_ = number_t}
| (["string"] | ["Stdlib"; "String"; "t"]), [] ->
{dependencies = []; type_ = string_t}
Expand Down
2 changes: 2 additions & 0 deletions tests/gentype_tests/typescript-react-example/src/Core.gen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export const taggedTemplate1: (x:((strings:TemplateStringsArray, ...values:strin

export const date1: (x:Date) => Date = CoreJS.date1 as any;

export const char0: (x:number) => number = CoreJS.char0 as any;

export const bigint0: (x:bigint) => bigint = CoreJS.bigint0 as any;

export const stdlibBigInt: (x:bigint) => bigint = CoreJS.stdlibBigInt as any;
Expand Down
3 changes: 3 additions & 0 deletions tests/gentype_tests/typescript-react-example/src/Core.res
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ let taggedTemplate1 = (x: TaggedTemplate.t<string, string>) => x
@genType
let date1 = (x: Date.t) => x

@genType
let char0 = (x: char) => x

@genType
let bigint0 = (x: bigint) => x

Expand Down
5 changes: 5 additions & 0 deletions tests/gentype_tests/typescript-react-example/src/Core.res.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading