Skip to content

type: class expression that extends passed argument of generic TypeConstructor is reported incorrectly by typeChecker as intersection of typesΒ #49116

Closed
@armano2

Description

@armano2

Bug Report

πŸ”Ž Search Terms

  • type
  • generic extends
  • class expression

πŸ•— Version & Regression Information

  • This allways reported incorrect data tested between versions 3.3.x and 4.6.2

⏯ Playground Link

Playground Link

Typescript Eslint

Ast Explorer

πŸ’» Code

function ClassWithName<TBase extends new (...args: any[]) => {}>(Base: TBase) {
	return class A extends Base {
	}
}

πŸ™ Actual behavior

Type of ClassExpression that extends generic not default TypeConstructor is incorrectly reported as Intersection without symbol set

image

πŸ™‚ Expected behavior

i expect to receive object with type TypeObject that has Object typeFlag set and properly defined symbol

This issue is present only if we extend class by other class thatr is provided by arg of function <TBase extends new (...args: any[]) => {}>(Base: TBase) and only if its a generic (template)

ref: typescript-eslint/typescript-eslint#4974

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions