vhfmag / ts-keysof.macro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tsguard.macro - Typescript type guard macro

Babel macro that automatically generates an array of keys from a given object type (very much WIP).

NPM

Roadmap

  • Implement tests
  • Support type references (e.g. keysof<IProps>)
  • Support index accessed types
  • Support imported types

Usage

import keysof from "ts-keysof.macro";

type Person = { name: string; age: number };

const personKeys = keysof<Person>(); // ["name", "age"]

About


Languages

Language:JavaScript 81.2%Language:TypeScript 18.3%Language:Standard ML 0.5%