Skip to content

Type parameter leaks #19854

@ghost

Description

TypeScript Version: 2.7.0-dev.20171108

Code

declare function first<T>(array: T[]): T | undefined;
function f(x?: string[]) {
	return first(x);
}
const x = f([]);

Expected behavior:

Type of x is {} | undefined.

Actual behavior:

Type of x is T | undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions