A transpiler from golang's type to typescript's type for collaboration between frontend & backend.

Overview

go2type

page snapshot

go2type.vercel.app (backup site)

A typescript transpiler that convert golang's type to typescript's type. Help front-end developer to work faster in daily work. My target is to provide a website tool to convert static text written in Golang interface structure to TypeScript type definition. So the lex & parser can only parse the code about type definition, which is be designed following.

Design

Don't support anonymous type, which is useless in interface definition. We support common type definition in interface like

  • Single Type
  • JSON Tag
  • Inline Structure
  • Comment

About data type, communication between frontend and backend, we just have basic type, compound structure type, and array type.

TypeScript Golang
Boolean boolean bool
Number number uint8/uint16/uint32/uint64/int8/int32/int64/float32/float64(don't think about complex)
String string string
Array Array | T[] []T
Structure Object Struct {}
Function - -
Pointer - -
Channel - -
Slice - -
Interface - -
Map - -

Example

This is a golang type definition.

// comment 
type Height int // comment
type Person struct {
   Name string  //  comment
   Age uint8 // comment
   Height Height  // comment
   Birthday uint8 `json:"birthday"` 
   Parents []Person
   School struct {
     MiddleSchool string
     HighSchool string
     College string
   }
}

We can convert it to TypeScript definition.

// comment 
type Height = number // comment
type Person = { //  comment
  Name: string // comment
  Age: number // comment
  Height: Height  // comment
  birthday: number
  Parents: Person[]
  School: {
    MiddleSchool: string
    HighSchool: string
    College: string
  }
}

TODO

  • alias go > 1.8 type A = string
  • operator *
  • map type map[string]string
You might also like...

Web3 Framework, 0% Backend, 10000% Frontend

██████ ██ ████ █████ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ STACK ██ ██ ██ ██ ██ ██ Network Without ██ ██ ████ █████

Dec 9, 2022

Repositorio común Backend-Frontend del equipo DevPanda

Instalaciones importantes: Nodejs Nodejs creará el entorno en el cuál React y Express van a ejecutarse. Se recomienda la version estable. Es una insta

May 11, 2022

Aprendendo os fundamentos do GraphQL do Backend ao Frontend!

📃 Projeto O GraphQL é totalmente independente da tecnologia que é utilizada no backend ou do frontend, do banco de dados, ou seja, para o GraphQL não

Jun 16, 2022

Learn how to set up Supabase auth for both the frontend and backend of your application using a JWT - JSON web token.

Learn how to set up Supabase auth for both the frontend and backend of your application using a JWT - JSON web token.

Supabase auth, frontend + backend - example with Next.js Learn how to set up Supabase auth for both the frontend and backend of your application using

Nov 20, 2022

sistema de bate ponto para os aprendizes da brisa, usando Angular no frontend, golang no backend e postgresql como banco.

Migule Points Este projeto tem o intuito de automatizar a frequência dos aprendizes da brisanet, usando Angular no front, Golang no backend e postgres

Sep 26, 2022

O objetivo dessa aplicação era criar um frontend feito totalmente em Javascript, sem nenhum arquivo HTML ou CSS pré-criado. Além disso, esse projeto também é o frontend da minha API 100% NodeJS.

O objetivo dessa aplicação era criar um frontend feito totalmente em Javascript, sem nenhum arquivo HTML ou CSS pré-criado. Além disso, esse projeto também é o frontend da minha API 100% NodeJS.

Projeto HTML 100% Javascript Front-end feito "sem HTML" Conteúdos ➜ Sobre o projeto ➜ O que aprendi ➜ Como usar 🔎 Sobre o projeto Voltar ao topo O ob

Aug 3, 2021

A type speed checking website which lets you check your typing speed and shows the real-tme leaderboards with mongodb as DB and express as backend

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mar 27, 2022

An automated tool help you to transform backend json data to TypeScript type.

ohmyts An automated tool help you to transform backend json data to TypeScript type. Quick Start Vite install npm i @ohmyts/vite -D 🤽 playground play

Sep 23, 2022
Owner
Oanakiaja
Digital enthusiast 🔥
Oanakiaja
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A TypeScript Transpiler for Cosmos Protobufs ⚛️

Telescope ?? Babel for the Cosmos A TypeScript Transpiler for Cosmos Protobufs Quickstart Follow the instructions below to kick off your Telescope mod

null 84 Dec 15, 2022
An experimental transpiler to bring tailwind macros to SWC 🚀

stailwc (speedy tailwind compiler) This is an experimental SWC transpiler to bring compile time tailwind macros to SWC (and nextjs) a-la twin macro. T

Alexander Lyon 140 Jan 3, 2023
The culmination of Encode Academy, the 8-week long Solidity course by Encode Club in collaboration with Extropy

Encode Academy | DAO: Real Estate & Renting What is this? This is the culmination of Encode Academy, the 8-week long Solidity course by Encode Club in

Oliver H. D. 5 May 25, 2022
Crowdsource and crowdfund collaboration on maps of problems.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

MapsMap 3 Dec 9, 2022
a/A MERN stack collaboration project

Welcome to Hoppers! Hoppers is an app where users can design their plan for the perfect night out with friends1. Users will be able to design and cust

Jonathan Wong 4 Apr 28, 2022
Gatsby-Formik-contact-form-with-backend-panel - Full working contact form with backend GUI panel.

Gatsby minimal starter ?? Quick start Create a Gatsby site. Use the Gatsby CLI to create a new site, specifying the minimal starter. # create a new Ga

Bart 1 Jan 2, 2022
Venni backend - The backend of the Venni client apps implementing the credit card payments, matching algorithms, bank transfers, trip rating system, and more.

Cloud Functions Description This repository contains the cloud functions used in the Firebase backend of the Venni apps. Local Development Setup For t

Abrantes 1 Jan 3, 2022
Web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control.

Linux Remote This is a web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control. Do

Gabriel Guerra 4 Jul 6, 2022