Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Fix conversion of Js.t containing an alias core type #263

Closed
IwanKaramazow opened this issue Feb 14, 2021 · 1 comment · Fixed by #291
Closed

Fix conversion of Js.t containing an alias core type #263

IwanKaramazow opened this issue Feb 14, 2021 · 1 comment · Fixed by #291

Comments

@IwanKaramazow
Copy link
Contributor

[@bs.deriving {abstract: light}]
type jsProps('a) = {
  config: Js.nullable(Js.t({..} as 'a)),
  image: Js.nullable(string),
  label: Js.nullable(string),
  maxwidth: Js.nullable(int),
};

The Js.t({..} as 'a) part is problematic. There's currently no way to express this in ReScript.
{..} is the syntax for Js.t({..}). So technically {..} as 'a (rescript), represents Js.t({..)) as 'a.
However in the above code the alias sits inside the Js.t.

@chenglou
Copy link
Member

Guess no need anymore after rescript-lang/rescript#4967

chenglou added a commit to chenglou/syntax that referenced this issue Feb 27, 2021
Fixes rescript-lang#277
Fixes rescript-lang#263

Now that rescript-lang/rescript#4967 has landed:
- Parse `{"foo": int}` as ocaml `{. foo: int}`. Previously it parsed into ocaml `{. foo: int} Js.t`
- Remove a tiny printing optimizations for `Js.t`.
- For React's PPX 3, generate objects directly instead of `Js.t` objects. cc @rickyvetter @ryyppy for ppx4.
- The re->res converter automatically removes the `Js.t` part.
- Said converter has a bug (rescript-lang#263) that converts `Js.t({..}) as 'a` into `{..} as 'a` from naturally forgetting to special-case that path. Now this bug is conveniently ~~made into a feature~~ obsolete.
chenglou added a commit to chenglou/syntax that referenced this issue Feb 27, 2021
Fixes rescript-lang#277
Fixes rescript-lang#263

Now that rescript-lang/rescript#4967 has landed:
- Parse `{"foo": int}` as ocaml `{. foo: int}`. Previously it parsed into ocaml `{. foo: int} Js.t`
- Remove a tiny printing optimizations for `Js.t`.
- For React's PPX 3, generate objects directly instead of `Js.t` objects. cc @rickyvetter @ryyppy for ppx4.
- The re->res converter automatically removes the `Js.t` part.
- Said converter has a bug (rescript-lang#263) that converts `Js.t({..}) as 'a` into `{..} as 'a` from naturally forgetting to special-case that path. Now this bug is conveniently ~~made into a feature~~ obsolete.
chenglou added a commit that referenced this issue Feb 27, 2021
Fixes #277
Fixes #263

Now that rescript-lang/rescript#4967 has landed:
- Parse `{"foo": int}` as ocaml `{. foo: int}`. Previously it parsed into ocaml `{. foo: int} Js.t`
- Remove a tiny printing optimizations for `Js.t`.
- For React's PPX 3, generate objects directly instead of `Js.t` objects. cc @rickyvetter @ryyppy for ppx4.
- The re->res converter automatically removes the `Js.t` part.
- Said converter has a bug (#263) that converts `Js.t({..}) as 'a` into `{..} as 'a` from naturally forgetting to special-case that path. Now this bug is conveniently ~~made into a feature~~ obsolete.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants