Skip to content

@template tag takes effect in TypeScript code #16358

@ghost

Description

TypeScript Version: nightly (2.4.0-dev.20170608)

Code

interface I { n: number; }

class C<T extends I> {
    constructor(readonly t: T) {}

    /** @template U */
    static create<U extends I>(u: U): C<U> {
        return new C(u);
    }
}

Expected behavior:

No error.

Actual behavior:

src/a.ts(7,41): error TS2344: Type 'U' does not satisfy the constraint 'I'.
src/a.ts(8,22): error TS2345: Argument of type 'U' is not assignable to parameter of type 'I'.

(Broken by #15856)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions