Conversation

mununki
module C = {
  type myProps = {
    x: string
  }
  
  @react.component(:myProps)
  let make = (~x: int) => React.string(x)
}

<C x="x" /> // This compiles and treats x as string, despite being declared as int

In the current implementation, when there's a type mismatch between the myProps type definition and the actual parameter type in the make function, the compiler silently uses the type from myProps, ignoring the type annotation in the make function. This can lead to unexpected behavior and confusion for developers.

@cristianoc

Can you hold on this until this is merged: #7192
That's a complex PR and I'd try to avoid introducing issues on merge.

@cristianoc

Something to check about this PR is whether it affects type inference. Not sure it does, but any change can be delicate.

@mununki

Can you hold on this until this is merged: #7192 That's a complex PR and I'd try to avoid introducing issues on merge.

Sure!

@mununkimununki force-pushed the fix-alias-props-type branch from dece53f to bca7852 Compare December 5, 2024 12:30
@mununkimununki force-pushed the fix-alias-props-type branch from bca7852 to 3330d57 Compare December 6, 2024 01:47
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.