rescript-lang / rescript-lang/rescript

Unintelligible error message with @return(nullable)

Open
#6,093 6 comments 0 reactions 1 assignee View on GitHub

@cknitt is already working on this.

Since May 5, 2025.

enhancement
Dominant language
OCaml
Stars
7.5k
Forks
485
Avg merge
1d 2h
Merged PRs (30d)
55

Description

When you have @return(nullable) on an external definition for a function that does not return option, e.g.,

@return(nullable)
external someFunc: unit => bool = "someFunc"

you get the following rather incomprehensible error message:

%@return directive *_to_opt expect return type to be 
syntax wise `_ option` for safety

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.