Skip to content

JSX4: loc missing in error for not existing prop #5957

Closed
@cknitt

Description

@cknitt

In certain cases, when referencing a prop that does not exist, the loc information seems to get lost.

E.g. for

module A = {
  @react.component
  let make = () => React.null
}

@react.component
let make = () => <A someProp={<div />} />

the error message does not show in which line the error occurred:

  This record expression is expected to have type A.props
  The field someProp does not belong to type A.props

and the error is shown in VS Code like this:

Bildschirm­foto 2023-01-26 um 10 32 57

Compare with this case which works fine:

module A = {
  @react.component
  let make = () => React.null
}

@react.component
let make = () => <A someProp="test" />

It gives

  6 │ @react.component
  7 │ let make = () => <A someProp="test" />
  8 │

  This record expression is expected to have type A.props
  The field someProp does not belong to type A.props

Bildschirm­foto 2023-01-26 um 10 38 25

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