can i skip the expresson of when it is not nessrly defined?

  Kiến thức lập trình

is there any syntax to avoid defining < T > in the statement when i don’t use the definition such that is ‘?data’ in below codes?

what i want looks like:

interface Props<?T> {
  className: string
  data?: T
}

const props: Props = {className: "hello, world"}
const propswithdata: Props<T> = {className: "hw", data: {something: "something"}}

LEAVE A COMMENT