@flesh-and-blood/types
TypeScript enums, interfaces, and pure helper functions for Flesh and Blood cards. This is the base
package that @flesh-and-blood/cards and @flesh-and-blood/search depend on.
It has no runtime dependencies.
Installation
npm i @flesh-and-blood/types
Published as dual ESM + CJS: works in bundlers, native Node ESM, and CommonJS.
Usage
import { Hero, Rarity, getDefaultPrinting } from "@flesh-and-blood/types";
Data and helper modules are also available as subpath imports, so you can pull in just what you need:
import { ReleaseType, getIsBooster } from "@flesh-and-blood/types/sets";
import { getDefaultPrinting } from "@flesh-and-blood/types/helpers";
import type { Card } from "@flesh-and-blood/types/interfaces";
What's included
The exported TypeScript types are the source of truth for exact values and fields; the lists below are an overview.
Enums
Bond, Class, Flow, Foiling, Format, Fusion, Hero, Keyword, Language, Meta,
Metatype, Rarity, Release, ReleaseEdition, ReleaseType, Shorthand, Subtype, Talent,
Trait, Treatment, Type.
Interfaces
Card (the main card shape), DoubleSidedCard, Printing, ReleaseInfo.
Helpers: @flesh-and-blood/types/helpers
- Printing pickers:
getPrint,getDefaultPrinting,getSpecialPrinting,getMaxRarityPrinting - Filter values:
getNormalizedFilterValue,PUNCTUATION - Card properties:
getCardIdentifier,getFrontAndBackCardIdentifier,getCardFromGEMCardIdentifier,getIsArenaCard,getIsDeckCard,getIsCardTokenForDeck,getCanCardBeTokenForDeck,getCanAddToDeck,getShouldRotateCardImage,getFamilyName,getBaselineHero
Release vocabulary: @flesh-and-blood/types/sets
Language, ReleaseType and the ReleaseInfo record type, plus getIsBooster, getIsReprint,
getIsDraftable, getIsPreconstructed. The release records themselves ship with the card data, as
releases from @flesh-and-blood/cards.
Working with this project
Source lives in src/ (interfaces.ts, sets.ts, helpers/).
npm run build # build:esm (per-file ESM, tree-shakeable) + build:cjs (bundled) + tsc declarations
npm test # vitest