Skip to content

Why I use function generic parameters as the other type's generic has compile error? #29225

Closed
@kunlongxu

Description

@kunlongxu

TypeScript Version: 3.3.0-dev.20190101

Search Terms: Why I use function generic parameters as the other type's generic has compile error?

Code

function fn1<U extends UU, UU>() {

    type T03<T> = {
      action: T;
    };
    type T04<F extends FF, FF> = T03<F> extends T03<FF> ? number : string;

    let v2: T04<"aaa", string> = 222;
    let v3: T04<U, UU> = 78787;
  }

Expected behavior:

 expect v3' type is number

Actual behavior:

Type '78787' is not assignable to type 'T04<U, UU>'.

Playground Link: Link

Metadata

Metadata

Assignees

Labels

Design LimitationConstraints of the existing architecture prevent this from being fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions