jaredly / jaredly/ppx_autoserialize

Error: The first object type has no method $bs

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
OCaml
Stars
27
Forks
4
PR merge metrics
No merged PRs in 30d

Description

```reason

type since =
| Daily
| Weekly
| Monthly;

Js.log (since__to_json Daily);

type fetchReposSuccess = {
since,
language: string,
};
```

These code would cause error:
```sh
l/js' -w -40 -w -30 -bs-super-errors -no-alias-deps -color always -o src/client/actions.cmj -c src/
client/actions.mlast

We've found a bug for you!
_none_

Is there an error before this one? If so, it's likely a syntax error. The more relevant message sh
ould be just above!
If it's not, please file an issue here:

github.com/facebook/reason/issues

This is: < > Js.t but somewhere wanted:
< $bs : string; arguments : 'a array; constructor : string;
type : string >
Js.t
The first object type has no method $bs

ninja: build stopped: subcommand failed.

```

But if I add option type for since then passed:

```reason

type fetchReposSuccess = {
since: option since,
language: string,
};
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the Reason snippet and the command shown for src/client/actions.mlast, then compare it with the version where since is wrapped in option. Trace the serialization handling for fetchReposSuccess and confirm the non-option variant case builds without the reported $bs error; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.