Skip to content

type never inference fails short with continuation passing style #8728

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions