Skip to content

TS2.4 compile error with derived type assignment #16790

Closed
@Diluka

Description

@Diluka

TypeScript Version: 2.4.1

Code

// A *self-contained* demonstration of the problem follows...
export class City extends BaseModel {
  //...
}
export abstract class BaseModel extends Model {
  //...
}
export abstract class Model {
  //...
}

Expected behavior:
compile without error
Actual behavior:

error TS2345: Argument of type 'typeof City' is not assignable to parameter of type 'typeof Model'.
  Type 'City' is not assignable to type 'Model'.
    Types of property 'set' are incompatible.
      Type '{ <K extends "reload" | "isNewRecord" | "sequelize" | "aggregate" | "where" | "getDataValue" | "s...' is not assignable to type '{ <K extends "reload" | "isNewRecord" | "sequelize" | "aggregate" | "where" | "getDataValue" | "s...'. Two different types with this name exist, but they are unrelated.
        Type 'City' is not assignable to type 'Model'.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions