How does TS declare a property as a class?

for example:

interface X {
  a: string
}

interface Y {
  X: X
}


class X implements X {
  public a: string = ""
}

const Y: Y = {
  X // <----- 
}

found that the X attribute reported an error when defining Y, and could not assign type "typeof X" to type "X". The attribute "a" is missing in type "typeof X".

Aug.02,2021

interface X {
  a: string
}


class X1 implements X {
  public a: string = ''
}

interface Y {
  X: typeof X1
}

const Y1: Y = {
  X:X1
}
Menu