Skip to content

Getting a source with a nullable value confuses type checker #71

@achia70

Description

@achia70

Vide 0.4.0 from Wally

Trying to get a source with a nullable value results in a type error, like this:

local someText = Vide.source(nil :: string?)

print(someText()) -- TypeError: Calling function (() -> string?) & ((string?) -> string?) with argument pack () is ambiguous.

someText("afjwirinefirwiuwefui")

if someText() then -- TypeError: Calling function (() -> string?) & ((string?) -> string?) with argument pack () is ambiguous.
	print(someText()) -- TypeError: Calling function (() -> string?) & ((string?) -> string?) with argument pack () is ambiguous.
end

This requires explicit casting to silent out the error:

print((someText :: () -> string?)())

someText("afjwirinefirwiuwefui")

if (someText :: () -> string?)() then
	print((someText :: () -> string)())
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions