@flesh-and-blood/types

中文文档
7.3.3发布于 2026/11/01MITTypeScriptESM + CJS零依赖

血肉卡牌类型的TypeScript表示

中文使用文档
文档目录8 节
  1. 安装
  2. 使用
  3. 包括什么
  4. 枚举
  5. 接口
  6. 助手: @flesh-and-blood/types/helpers
  7. 释放的词汇: @flesh-and-blood/types/sets
  8. 参与这个项目

@flesh-and-blood /类型

的枚举、接口和纯帮助函数 血肉之躯 卡片。这是底边 包, @flesh-and-blood/cards 和 @flesh-and-blood/search 依赖。 它没有运行时依赖项。

安装

npm i @flesh-and-blood/types

出版 双ESM + CJS工作在捆绑器、本地Node ESM和CommonJS中。

使用

import { Hero, Rarity, getDefaultPrinting } from "@flesh-and-blood/types";

数据和助手模块也可以作为子路径导入,所以你可以只拉入你需要的:

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";

包括什么

导出的TypeScript类型是精确值和字段的真实来源;下面的列表是 概述。

枚举

Bond, Class, Flow, Foiling, Format, Fusion, Hero, Keyword, Language, Meta, Metatype, Rarity, Release, ReleaseEdition, ReleaseType, Shorthand, Subtype, Talent, Trait, Treatment, Type.

接口

Card (主卡形), DoubleSidedCard, Printing, ReleaseInfo.

助手: @flesh-and-blood/types/helpers

  • 印刷器: getPrint, getDefaultPrinting, getSpecialPrinting, getMaxRarityPrinting
  • 过滤值: getNormalizedFilterValue, PUNCTUATION
  • 卡属性: getCardIdentifier, getFrontAndBackCardIdentifier, getCardFromGEMCardIdentifier, getIsArenaCard, getIsDeckCard, getIsCardTokenForDeck, getCanCardBeTokenForDeck, getCanAddToDeck, getShouldRotateCardImage, getFamilyName, getBaselineHero

释放的词汇: @flesh-and-blood/types/sets

Language, ReleaseType 和 ReleaseInfo 记录类型,加上 getIsBooster, getIsReprint, getIsDraftable, getIsPreconstructed。发布记录本身随卡数据一起发货,如 releases 从 @flesh-and-blood/cards.

参与这个项目

来源生活在 src/ (interfaces.ts, sets.ts, helpers/)。

npm run build   # build:esm (per-file ESM, tree-shakeable) + build:cjs (bundled) + tsc declarations
npm test        # vitest

版本与发布记录

@flesh-and-blood/types 共发布 371 个版本,首次发布于 2023/09/14;过去 12 个月发布了 112 个版本。

版本发布日期距今
7.3.3latest2026/11/012 天前
7.3.22026/11/012 天前
7.3.12026/10/304 天前
7.3.02026/10/295 天前
7.2.02026/10/285 天前
7.1.102026/10/286 天前

关于 @flesh-and-blood/types 的常见问题

@flesh-and-blood/types 是什么?

血肉卡牌类型的TypeScript表示

如何安装 @flesh-and-blood/types?

在项目目录运行 npm install @flesh-and-blood/types,或使用 pnpm add / yarn add / bun add。

@flesh-and-blood/types 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flesh-and-blood/types 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flesh-and-blood/types 可以商用吗?

@flesh-and-blood/types 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flesh-and-blood/types 还在维护吗?

最新版本 7.3.3 发布于 2026/11/01(2 天前);至今共发布 371 个版本,其中过去 12 个月发布了 112 个;首次发布于 2023/09/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。