Basic problems of typescript and react

import * as React from "react"
import * as Reactdom from "react-dom"

interface Person {
  firstName: string;
  middleName?: string;
  lastName: string;
}

class Greeter extends React.Component<Person> {
  fullName: string
  constructor (props) {
    super(props)
    this.setFullName(props.person)
  }
  setFullName = function<Person>(person) {
    this.fullName = `${person.firstName}${person.lastName}`
  }
  sayName = ():string => this.fullName
  render () {
    return (
      <div>{this.sayName}</div>
    )
  }
}

const jor:Person = {
  firstName: "michale",
  lastName: "jordan",
}

Reactdom.render(<Greeter person={jor} />, document.getElementById("-sharpapp") as HTMLElement)

Why is this prompted?

[ts]
cannot assign type "{person: Person;}" to type "IntrinsicAttributes & IntrinsicClassAttributes < Greeter > & Readonly < {children?: ReactNode;} > & R.".
cannot assign type "{person: Person;}" to type "Readonly < Person >". The attribute "firstName" is missing in
type "{person: Person;}".

what does this mean


learn react first, and then write react in typescript

import * as React from 'react'
import * as Reactdom from 'react-dom'

interface Person {
  firstName: string;
  middleName?: string;
  lastName: string;
}

class Greeter extends React.Component<{person:Person}> {
  fullName: string
  constructor (props) {
    super(props)
    this.setFullName(props.person)
  }
  setFullName(person:Person) {
    this.fullName = `${person.firstName}${person.lastName}`
  }
  sayName = ():string => this.fullName
  render () {
    return (
      <div>{this.sayName()}</div>
    )
  }
}

const jor:Person = {
  firstName: 'michale',
  lastName: 'jordan',
}

Reactdom.render(<Greeter person={jor} />, document.getElementById('-sharpapp') as HTMLElement)

write

like this
constructor (props: Person) {
    super(props)
    this.setFullName(props)
}
setFullName = (person: Person) => {
    this.fullName = `${person.firstName}${person.lastName}`
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bf8f-2c2df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bf8f-2c2df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?