Skip to content

type never inference fails short with continuation passing style #8728

@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd

nightly build

function fail(message: string) : never { throw new Error(message); }
function withFew<a, r>(values: a[], haveFew: (values: a[]) => r, haveNone: (reason: string) => r): r {
    return values.length > 0 ? haveFew(values) : haveNone('No values.');
}
function id<a>(value: a) : a { return value; }
const result = withFew([1, 2, 3], id, fail); // expected result of number[], actual inference problem

image

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

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