Skip to content

JSXv4: Locally abstract types do not seem to be in scope in the component body #5978

Closed
@glennsl

Description

@glennsl

Based on the following two scenarios causing errors:

Repro 1

module type T = {
  type t
}

@react.component
let make = (type a, ~foo: module(T with type t = a)) => {
  module T = unpack(foo)
  <div />
}

yields the error:

[E] Line 7, column 13:
The type of this packed module contains variables:
module(T with type t = 'type-a0)

Repro 2

module type T = {
  type t
}

@react.component
let make = (type a, ~foo) => {
  module T = unpack(foo: T with type t = a)
  <div />
}

yields the error:

[E] Line 7, column 41:
This type constructor, `a`, can't be found.
  If you wanted to write a recursive type, don't forget the `rec` in `type rec`

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions