Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Cannot implement generic type guarding function #18202

Copy link
Copy link
@apr-xaml

Description

@apr-xaml
Issue body actions

TypeScript Version: 2.5.2

Code

interface ITypeChecker
{
    isOfType<T extends TBase, TBase>(obj: TBase): obj is T; 
}


class Checker implements ITypeChecker
{
    isOfType<T extends TBase, TBase>(obj: TBase): obj is T
    {
        return true;
    }

}

Expected behavior:
Class Checker should be treated as a valid implementation (used to be in Ts-2.3).
Actual behavior:
Compiler complains:

  • interface-not-properly-implemented
    (...)
    • Type predicate 'value is TBase' is not assignable to 'value is T'
      • Type 'TBase' is not assignable to type 'T'
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptA 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.