Skip to content

Error trying to create nullable function #236

@andy-hanson

Description

@andy-hanson
export function test(b: boolean): (() => i32) | null {
	if (b) {
		return (): i32 => 1;
	} else {
		return null;
	}
}

Expected: No error.
Actual:

ERROR AS200: Conversion from type 'usize' to '(() => i32) | null' requires an explicit cast.

 		return null;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions