Skip to main content
Home
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
70%
Published
4 months ago (0.0.10)

license JSR JSR Score

@g43/types

A collection of TypeScript type definitions for common data structures and utility types.

Installation

# Using JSR
npx jsr add @g43/types

# Using Deno
import { SimpleVector2, MinMax3D, PartiallyOptional } from "jsr:@g43/types";

Features

  • Vector Types: Simple vector interfaces for 2D, 3D, and 4D coordinates
  • Size Types: Interfaces for representing 2D and 3D sizes
  • Position and Size: Combined position and size interfaces for 2D and 3D
  • Min-Max Bounds: Types for representing bounding boxes in 2D and 3D
  • Alignment Options: Enums for horizontal and vertical alignment
  • Utility Types: Helper types like PartiallyOptional and PartiallyRequired
  • Coordinate Types: XYWH and XYZWHD interfaces for position and dimensions

Usage

import { MinMax3D, PartiallyOptional, SimpleVector2 } from "@g43/types";

// Using vector types
const point: SimpleVector2 = { x: 10, y: 20 };

// Using bounding box types
const boundingBox: MinMax3D = {
    min: { x: 0, y: 0, z: 0 },
    max: { x: 10, y: 20, z: 30 },
};

// Using utility types
interface User {
    id: number;
    name: string;
    email: string;
    avatar: string;
}

// Only avatar is optional, everything else is required
type NewUserForm = PartiallyOptional<User, "avatar">;

API Documentation

For detailed API documentation, see the full documentation.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@g43/types

Import symbol

import * as types from "@g43/types";
or

Import directly with a jsr specifier

import * as types from "jsr:@g43/types";

Add Package

pnpm i jsr:@g43/types
or (using pnpm 10.8 or older)
pnpm dlx jsr add @g43/types

Import symbol

import * as types from "@g43/types";

Add Package

yarn add jsr:@g43/types
or (using Yarn 4.8 or older)
yarn dlx jsr add @g43/types

Import symbol

import * as types from "@g43/types";

Add Package

vlt install jsr:@g43/types

Import symbol

import * as types from "@g43/types";

Add Package

npx jsr add @g43/types

Import symbol

import * as types from "@g43/types";

Add Package

bunx jsr add @g43/types

Import symbol

import * as types from "@g43/types";