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

@tencent-internal/ts-common

v1.0.12

Published

TypeScript 通用类型和工具库

Readme

@tencent-international/ts-common

TypeScript 通用类型和工具库

安装

从 GitHub Packages 安装

# 配置 npm 使用 GitHub Packages
npm config set @tencent-international:registry https://npm.pkg.github.com
npm config set //npm.pkg.github.com/:_authToken YOUR_GITHUB_TOKEN

# 安装包
npm install @tencent-international/ts-common

从 npm 安装(如果已发布到 npm)

npm install @tencent-international/ts-common
# 或
yarn add @tencent-international/ts-common

使用方法

1. 全局类型使用

安装后,BasicTypes 会自动全局可用,无需导入:

// 直接使用 BasicTypes 命名空间中的类型
const header: BasicTypes.DefaultBaseHeader = {
  Authorization: 'Bearer token',
  'User-Agent': 'MyApp/1.0',
  'Accept-Language': 'zh-CN',
  'X-Locale': 'zh-CN'
};

const response: BasicTypes.DefaultResponseWrapper<string> = {
  success: true,
  data: 'Hello World'
};

const contentType: BasicTypes.ContentType = 'application/json';
const countryCode: BasicTypes.CountryCode = '86';
const gender: BasicTypes.Gender = 'male';
const locale: BasicTypes.Locale = 'zh-CN';
const platform: BasicTypes.Platform = 'pc';

2. 模块导入使用

也可以导入其他模块:

import { dictionary, request } from '@tencent-international/ts-common';

// 使用导入的功能

开发

构建

yarn build

开发模式

yarn dev

发布

手动发布到 GitHub Packages

# 1. 登录到 GitHub Packages
npm login --registry=https://npm.pkg.github.com

# 2. 构建项目
yarn build

# 3. 发布到 GitHub Packages
yarn publish

自动发布(推荐)

  1. 创建并推送标签:
git tag v1.0.0
git push origin v1.0.0
  1. GitHub Actions 会自动构建并发布到 GitHub Packages

类型说明

BasicTypes 命名空间

包含以下类型定义:

  • DefaultBaseHeader: 默认请求头接口
  • DefaultResponseWrapper<T>: 默认响应包装器
  • ErrorDetails: 错误详情接口
  • PublicUploadCredentials: 公共上传凭证
  • Request: 请求接口
  • SigningRequest: 签名请求接口
  • ContentType: 内容类型
  • CountryCode: 国家代码
  • ErrType: 错误类型
  • Gender: 性别
  • Locale: 语言环境
  • Platform: 平台类型

发布流程

自动发布(推荐)

  1. 更新版本号:yarn version patch|minor|major
  2. 推送代码和标签:git push && git push --tags
  3. GitHub Actions 自动构建并发布

手动发布

  1. 更新版本号:yarn version patch|minor|major
  2. 构建项目:yarn build
  3. 发布到 GitHub Packages:yarn publish

注意事项

  • BasicTypes.d.ts 文件会被包含在发布包中,确保全局类型可用
  • 使用 tsconfig.json 中的 types 字段来全局引用类型
  • 支持 CommonJS 和 ESM 两种模块格式
  • 包发布到 GitHub Packages,需要配置相应的 registry