Skip to content

Improve error message when adding type to generic application #7969

@nojaf

Description

@nojaf

Consider

https://rescript-lang.org/try?version=v12.0.0-beta.13&module=esmodule&code=LYewJgrgNgpgBAdRgIwIIAUCScC8cDeAUHAJCiSxwAiA8gLIbZ5EkkAuAngA7wyzAwAdm2JwAvnEJjChWGzh8YA4QCUYAMwDCIAE46YAY3kAuOGoCGRgHT71AHgBy0KOeSwrbO0jRYrtBr6KymwAfCG4ZjCWbFYQAM4wauoAFE5QLm4wVoLOAJSyMPJBQmxJERbW8YkaXiiMfvT1xcIhqc6u7jnp+UA

module WebAPI = { module DOMAPI = { type element } } let elementRefCorrect : React.ref<Nullable.t<WebAPI.DOMAPI.element>> = React.useRef(Nullable.null) let elementRef = React.useRef<WebAPI.DOMAPI.element>(Nullable.null)

In F#, you can specify the React.useRef<WebAPI.DOMAPI.element> syntax.
I can live with the fact that ReScript doesn't have the same syntax as F#.
But the error message is very confusing:

Type Errors [E] Line 8, column 30: The value element can't be found in WebAPI.DOMAPI 

The type does exists, whatever I'm going for syntax-wise is the issue here.
Could we improve this?
Thoughts @zth?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions