Skip to content

gmh5225/tsints

 
 

Repository files navigation

tsints

a parser for typescript types, written in typescript types (no js here!)

testimonials

please no please I beg you — @jakebailey.dev

EM WHAT THE FUCK

ur deranged

hell yeah

i cant wait to do ludicrous shit with ts7 speeds

usage

code like this

import type { Parse } from "./parser/index.ts";
type _ = Parse<"{some:[ts, 'type']}">;

evaluates to a @babel/parser-style AST

type _ = {
  type: "TSTypeLiteral";
  members: [
    {
      type: "TSPropertySignature";
      key: {
        type: "Identifier";
        name: "some";
      };
      computed: false;
      typeAnnotation: {
        type: "TSTypeAnnotation";
        typeAnnotation: {
          type: "TSTupleType";
          elementTypes: [
            {
              type: "TSTypeReference";
              typeName: {
                type: "Identifier";
                name: "ts";
              };
            },
            {
              type: "TSLiteralType";
              literal: {
                type: "StringLiteral";
                raw: "'type'";
              };
            },
          ];
        };
      };
    },
  ];
};

should i use this

idk, do you want to spend 5 extra seconds every time you run tsc waiting for it to evaluate the parsing code?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 100.0%