Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support type parameters in record type spread #6291

Closed
cristianoc opened this issue Jun 8, 2023 · 3 comments
Closed

Support type parameters in record type spread #6291

cristianoc opened this issue Jun 8, 2023 · 3 comments
Assignees
Milestone

Comments

@cristianoc
Copy link
Collaborator

cristianoc commented Jun 8, 2023

https://forum.rescript-lang.org/t/ann-enhanced-ergonomics-for-record-types/4480/8?u=cristianoc

Example:

type x<'a> = {
  a: 'a,
  b: int,
}

type y<'a> = {
  ...x<'a>,
  c: float,
}

There are few choices possible here. The simplest, most restrictive one is:

  • y has the same number and names of type parameters as x, then there's nothing else to check.
@cristianoc cristianoc added this to the v12 milestone Jun 8, 2023
@cristianoc cristianoc changed the title Support type variables in record type spread Support type parameters in record type spread Jun 8, 2023
@fhammerschmidt
Copy link
Member

fhammerschmidt commented Jun 9, 2023

Will it really be only in version 12? Currently I am spreading MUI's useAutocomplete props into the MUI Autocomplete props.

type autocompleteProps<'a> = {
  ...UseAutocomplete.props<'a>,
  ...
}

But that gives me an unbound type parameter error, as expected.

My current workaround makes me spread only a subset of the props that contain no type parameters, while I add the remaining props manually to the Autocomplete props.

I am not sure if I there is a need to support different numbers and names of type parameters. It would be cool if the simplest form could be added to v11 still.

@cristianoc
Copy link
Collaborator Author

Kind of follows after #6293
Once that's solved, this can be revisited.

@cristianoc cristianoc modified the milestones: v12, v11.0 Jun 22, 2023
@cristianoc
Copy link
Collaborator Author

Investigation here: #6309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants