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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@flatfile/implementation-utils-type-helpers

v0.0.4

Published

Provides common Typescript helpers for Flatfile Implementations

Readme

@flatfile/implementation-utils-type-helpers

Provides common Typescript helpers for Flatfile Implementations.

Features

Guards

  • isArrayOfType: A generic guard that checks if a value is an array of a specific type based on an input type guard.
  • isStringArray: A guard that checks if a value is a string array.
  • isMessage: A guard that checks if a value is a message in the format "__i" expects in the Flatfile v2/records.jsonl endpoint.

Type Derivation

  • RowInputFromFields: Derives a row input from a sheet configuration, a row input contains only nullable string fields.
  • RowFromFields: Derives a row type from a sheet configuration.
  • RowStrict: Derives the keys of a sheet that have a specific constraint.

Usage

Working with isArrayOfType and isMessage

import {
  isArrayOfType,
  isMessage,
} from "@flatfile/implementation-utils-type-helpers";

const records = safe.records.stream({ sheetId: "someSheetId" });
const messages = isArrayOfType(records.first().get("__i"), isMessage);
// messages is now of type Message[]

Working with Type Derivation patterns.

Below is a pattern for defining a strongly typed sheet config and deriving the types from it.

import {
  RowInputFromFields,
  RowFromFields,
  RowStrict,
} from "@flatfile/implementation-utils-type-helpers";
import { SetFieldType, Merge, Simplify } from "type-fest";
import { SheetConfig } from "@flatfile/api/api";

export const FIELD_KEY_name = "name" as const;

export type UserFieldKey = typeof FIELD_KEY_NAME;

type UserField = SetFieldType<Flatfile.Property, "key", UserFieldKey>;

export type UserSheetConfig = Simplify<
  Merge<
    SheetConfig,
    {
      fields: UserField[];
    }
  >
>;

const userSheet: UserSheetConfig = {
  fields: [
    {
      key: FIELD_KEY_NAME,
      type: "string",
      constraints: [{ type: "required" }],
    },
  ],
} as const;

export type UserRecord = RowFromFields<typeof userSheet.fields>;
export type UserRecordInput = RowInputFromFields<typeof userSheet.fields>;
export type UserRecordStrict = RowStrict<typeof userSheet.fields, "required">;