Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 572 Bytes

README.md

File metadata and controls

27 lines (20 loc) · 572 Bytes

Our own type system

A compiler which checks types for 3 scenarios:

  1. Issue with un-compatible types on declaration and expression
fn("craig-string"); // throw with string vs number
function fn(a: number) {}
  1. Issue with unknown type on declaration and expression
fn("craig-string"); // throw with string vs ?
function fn(a: made_up_type) {} // throw with bad type
  1. Issue with property name
interface Person {
  name: string;
}
fn({ nam: "craig" }); // throw with "nam" vs "name"
function fn(a: Person) {}