profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

TypeScript Inline Type Annotation

Syntax

var name: {
  first: string
  second: string
}
name = {
  first: "John",
  second: "Doe",
}

name = {
  // Error : `second` is missing
  first: "John",
}
name = {
  // Error : `second` is the wrong type
  first: "John",
  second: 1337,
}

Related