How does TS declare function objects?

for example:

interface A {
  (a: number): number
}

interface B extends A {
  b: string
}

const X: B = (a) => {
  return a
}

X(1)
X.b = "x"

how do I create objects that conform to the B interface convention ?

Apr.11,2021

https://www.typescriptlang.or.
Hybrid Types

const x: B = Object.assign(
  (a: number) => a,
  {
    b: "string"
  }
)
Menu