Zero Supports TypeScript

v1.0.11 lands support for TypeScript. Which means you can use it to write API endpoints and also React pages.

TypeScript for Node.js

You can export your TypeScript function in a .ts file. Like this:

// ./hello.ts
import * as express from "express";

function handler(req: express.Request, res: express.Response) {
  res.send("Hello TypeScript")
}
export default handler

Zero will detect dependencies and auto-install them.

TypeScript for React

You can also use TypeScript to write React pages. Just export a React component in a .tsx file:

// ./index.tsx
import * as React from "react";
import moment from 'moment';

export default class HelloWorld extends React.Component<{}, {}> {
   render() {
      return (
      <div>
         <b>Hello TypeScript</b>
         <p>Time: {moment().format('LT')}</p>
      </div>);
   }
}

Copyright © 2019 Remote Interview, Inc. All rights reserved.