Javascript with Superpowers

TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale.

Oct 23 2022


Typescript gives javascript superpowers - if you want to up your game as a web developer or as a javascript developer learning Typescript is the way to go!

React with Typescript Snippet

export type GreetProps = {
  name: string;
  messageCount?: number | string;
  isLoggedIn: boolean;
  isEnrolled?: boolean; // optional prop
};
function Greet({ name, messageCount, isEnrolled, isLoggedIn }: GreetProps) {
  return (
    <div>
      {isLoggedIn ? (
        <div>
          <h2>
            Welcome {name}! You have {messageCount} unread messages.
          </h2>
          {isEnrolled && <h2>Enrolled</h2>}
        </div>
      ) : (
        <h2>Welcome Guest!</h2>
      )}
    </div>
  );
}

export default Greet;

If you want to dive deep into TS, learn more about it here.