npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

typenative

v0.0.20

Published

Build native applications using Typescript.

Readme

TypeNative

Build native applications using Typescript.

PreRequisites

Get Started

  • Write a file test.ts with content console.log('Hello World!'); or any other message
  • Run npx typenative --source test.ts --script

Typescript Syntax Support

TypeNative currently supports a focused subset of TypeScript syntax elements that are transpiled to Go code. The support is grouped by topic for easier scanning.

Basic Types

| Feature | Supported | Notes | | -------------- | :-------: | ------------------------------------------------------------- | | number | ✅ | Transpiled to float64 | | boolean | ✅ | Transpiled to bool | | string | ✅ | | | null | ✅ | | | any | ✅ | Used for type inference | | Nullable types | ✅ | T \| null / T \| undefined transpiled to Go pointer types |

Variables & Objects

| Feature | Supported | Notes | | ---------------------- | :-------: | ----------------------------------------------- | | Variable declarations | ✅ | let and const | | Object literals | ✅ | Transpiled to Go struct literals | | Object shorthand | ✅ | { name }{ name: name } | | Array destructuring | ✅ | const [a, b] = arr | | Object destructuring | ✅ | const { x, y } = obj |

Operators

| Feature | Supported | Notes | | ------------------------ | :-------: | ------------------------------ | | Arithmetic operators | ✅ | +, -, etc. | | Comparison operators | ✅ | ==, !=, ===, !==, etc. | | Logical operators | ✅ | &&, \|\| | | Increment/Decrement | ✅ | ++, -- | | Spread operator | ✅ | [...arr], fn(...args) | | Non-null assertion (!) | ✅ | Stripped during transpilation | | Ternary expressions | ✅ | condition ? a : b | | Nullish coalescing | ✅ | ?? operator | | Optional chaining | ✅ | obj?.prop, arr?.[i] |

Control Flow

| Feature | Supported | Notes | | ------------------ | :-------: | ------------------------------------------------------ | | If/Else statements | ✅ | Fully supported | | Switch statements | ✅ | Case and default statements | | For loops | ✅ | Standard for loops | | For...of loops | ✅ | Arrays, Maps, Sets; Object.entries() unwrapping | | For...in loops | ✅ | Iterates keys via Go range | | While loops | ✅ | Transpiled to Go's for loops | | Do...while loops | ✅ | Implemented with conditional break | | Try/Catch/Finally | ✅ | throwpanic; catch/finally via defer/recover |

Data Structures & Array Methods

| Feature | Supported | Notes | | -------------------------- | :-------: | --------------------------------------------------------------------------------------------- | | Arrays | ✅ | Basic array operations | | Array methods | ✅ | push, pop, shift, unshift, join, slice, concat, reverse, sort, flat, at | | Higher-order array methods | ✅ | .map(), .filter(), .some(), .find(), .findIndex(), .every(), .forEach(), .reduce() | | Method chaining | ✅ | e.g. .map(...).filter(...).join(...) | | Map | ✅ | Map<K, V> → Go map[K]V; .set(), .get(), .has(), .delete(), .clear(), .size | | Set | ✅ | Set<T> → Go map[T]struct{}; .add(), .has(), .delete(), .clear(), .size |

Functions

| Feature | Supported | Notes | | ---------------------------- | :-------: | ----------------------------------------------------------- | | Function declarations | ✅ | Transpiled to Go functions | | Arrow functions | ✅ | Transpiled to anonymous functions | | IIFEs | ✅ | (() => { ... })() and (function name() { ... })() | | Closures over mutable state | ✅ | Functions capturing and mutating outer variables | | Function types | ✅ | () => number, (x: number) => string as type annotations | | Generics (functions/classes) | ✅ | Type parameters via Go generics | | Default parameter values | ✅ | function(x = defaultValue) | | Rest parameters | ✅ | function(...args: T[]) → Go variadic |

Classes & Interfaces

| Feature | Supported | Notes | | ------------------- | :-------: | -------------------------------------------------------------- | | Classes | ✅ | Transpiled to Go structs with constructor and receiver methods | | Class inheritance | ✅ | extends via embedded structs, super() supported | | Static members | ✅ | static method() / static prop → package-level declarations | | Getters / Setters | ✅ | get prop()Get_prop(), set prop(v)Set_prop(v) | | Interfaces | ✅ | Transpiled to Go interfaces, supports extends | | Optional properties | ✅ | prop?: Type in interfaces/types | | Enums | ✅ | enum declarations and member access |

Async & Timing

| Feature | Supported | Notes | | ----------- | :-------: | ----------------------------------------------------------------- | | Async/Await | ✅ | async functions return Go channels, await reads from channels | | Promises | ✅ | new Promise transpiled to channel + goroutine pattern | | setTimeout | ✅ | Mapped to Go's time.AfterFunc |

Built-in Functions & Utilities

| Feature | Supported | Notes | | --------------------- | :-------: | ----------------------------------------------------- | | console.log | ✅ | Mapped to fmt.Println | | console.error | ✅ | Mapped to fmt.Fprintln(os.Stderr, ...) | | console.time/timeEnd | ✅ | Performance measurement via time.Now / time.Since | | assert | ✅ | Transpiled to panic on failure | | parseInt / parseFloat | ✅ | Mapped to Go's strconv package | | JSON.stringify | ✅ | Mapped to encoding/json Marshal / MarshalIndent | | JSON.parse | ✅ | Mapped to encoding/json Unmarshal | | Object.keys/values | ✅ | Map key/value iteration helpers | | process.argv | ✅ | Mapped to os.Args | | process.platform | ✅ | Mapped to runtime.GOOS | | process.exit | ✅ | Mapped to os.Exit |

Math Methods

| Feature | Supported | Notes | | ------------------------- | :-------: | ------------------------------------------------- | | Math.random | ✅ | Mapped to rand.Float64() | | Math.floor / ceil / round | ✅ | Mapped to math.Floor, math.Ceil, math.Round | | Math.abs / sqrt / pow | ✅ | Mapped to corresponding math functions | | Math.min / max | ✅ | Mapped to math.Min, math.Max | | Math.log / log2 / log10 | ✅ | Mapped to math.Log, math.Log2, math.Log10 | | Math.sin / cos / tan | ✅ | Mapped to math.Sin, math.Cos, math.Tan | | Math.trunc / sign | ✅ | Mapped to math.Trunc and inline sign check |

String Methods

| Feature | Supported | Notes | | -------------------------- | :-------: | --------------------------------------------- | | Template literals | ✅ | Backtick strings with ${expr} interpolation | | toUpperCase / toLowerCase | ✅ | Via strings package | | trim / trimStart / trimEnd | ✅ | Via strings package | | split / includes / indexOf | ✅ | Via strings package | | startsWith / endsWith | ✅ | Via strings package | | replace / replaceAll | ✅ | Via strings package | | charAt / substring / slice | ✅ | Direct Go string indexing/slicing | | concat / repeat | ✅ | String concatenation and strings.Repeat | | padStart / padEnd | ✅ | Via strings.Repeat | | match / matchAll / search | ✅ | Via regexp package | | at | ✅ | Supports negative indices |

Number / Object Methods

| Feature | Supported | Notes | | -------- | :-------: | ----------------------------------------------------- | | toString | ✅ | Universal toString() via fmt.Sprintf for any type |

RegExp

| Feature | Supported | Notes | | -------------- | :-------: | --------------------------------------------------- | | Regex literals | ✅ | /pattern/flags transpiled to regexp.MustCompile | | new RegExp() | ✅ | Constructor with optional flags | | test() | ✅ | Mapped to regexp.MatchString | | exec() | ✅ | Mapped to regexp.FindStringSubmatch |

Modules & Imports

| Feature | Supported | Notes | | ------------------------ | :-------: | ------------------------------------------------------------------ | | Named imports | ✅ | import { x } from './file' | | Default imports | ✅ | import x from 'pkg' — namespace stripped in output | | Namespace imports | ✅ | import * as x from 'pkg' | | Local file imports | ✅ | Relative paths transpiled to a separate Go file | | Node.js built-in imports | ✅ | import { join } from 'node:path' mapped to Go stdlib | | Go package imports | ✅ | import { x } from 'go:pkg' | | npm package imports | ✅ | import { x } from 'pkg' mapped to Go module imports | | Named exports | ✅ | export function / export const declarations |

TypeNative is currently in early development and new features are being added regularly. The goal for 1.0 release is for TypeNative to transpile itself.