在线演练场
在浏览器中直接体验 uni-types,实时查看类型检查效果!
TypeScript Playground
Edit the code below and see real-time type checking. Hover over types to see their definitions.
Loading TypeScript editor...
如何使用
- 编辑代码 - 在编辑器中修改 TypeScript 代码
- 查看类型提示 - 将鼠标悬停在类型名称上查看定义
- 检查错误 - 实时显示类型错误
- 加载示例 - 点击示例按钮加载不同的代码示例
功能特性
- 🎯 实时类型检查 - 输入时即可看到类型错误
- 💡 智能提示 - 悬停查看类型定义
- 📦 预加载类型 - 所有 uni-types 都可直接导入
- 🎨 语法高亮 - 完整的 TypeScript 语法支持
可用类型 (2500+)
所有 uni-types 类型都可用:
核心操作
typescript
import type {
PickRequired, PickPartial, OmitRequired, OmitPartial
} from 'uni-types'元组操作
typescript
import type {
Head, Last, Tail, Init, Reverse, Flatten, TupleLength, IsEmptyTuple
} from 'uni-types'深度操作
typescript
import type {
DeepPartial, DeepRequired, DeepReadonly, DeepMutable, DeepOmit, DeepPick
} from 'uni-types'品牌类型
typescript
import type { Brand, Unbrand } from 'uni-types'条件类型
typescript
import type { If, Not, And, Or } from 'uni-types'函数类型
typescript
import type {
Parameters, ReturnType, NthParameter, AsyncReturnType
} from 'uni-types'键工具
typescript
import type {
RenameKeys, PrefixKeys, SuffixKeys, KeysByValueType
} from 'uni-types'数字类型
typescript
import type { Inc, Dec, Add, Subtract, Range } from 'uni-types'路径工具
typescript
import type {
ValidPath, ArrayPaths, LeafPaths, PathLength
} from 'uni-types'记录类型
typescript
import type {
DeepNullable, DeepOptional, Immutable, Mutable
} from 'uni-types'模板字面量
typescript
import type {
ReplaceAll, Trim, StringLength, Repeat
} from 'uni-types'类型判断
typescript
import type {
IsArray, IsTuple, IsEqual, IsAny, IsNever, IsUnknown
} from 'uni-types'类型推导
typescript
import type {
Awaited, ArrayElement, ValueOf, FunctionKeys, NonFunctionKeys,
FirstParameter, FunctionOnly, DataOnly
} from 'uni-types'实用类型
typescript
import type {
Merge, NonNullable, Exclusive, NoNullish, Nullable, Optional,
Maybe, LoosePartial, AtLeastOne, StrictExtract, StrictExclude,
UnionToIntersection, UnionToTuple
} from 'uni-types'键类型
typescript
import type {
RequiredKeys, OptionalKeys, WritableKeys, ReadonlyKeys
} from 'uni-types'路径类型
typescript
import type { Paths, PathValue, SplitPath } from 'uni-types'字符串命名
typescript
import type {
CamelCase, SnakeCase, CamelCaseKeys, SnakeCaseKeys
} from 'uni-types'算法
typescript
import type {
Sort, QuickSort, MergeSort, GCD, LCM, Factorial, Fibonacci, IsPrime,
Find, FindIndex, Includes, IndexOf, LongestCommonPrefix,
Reverse, Unique, Flatten, FlattenDeep, LevenshteinDistance
} from 'uni-types'解析器
typescript
import type {
ParseJSON, StringifyJSON, IsValidJSON, ParseURL, QueryParams, ParseCSV
} from 'uni-types'状态机
typescript
import type { StateMachine, State, Transition } from 'uni-types'数据结构
typescript
import type {
Tree, TreeNode, Graph, LinkedList, Stack, Queue
} from 'uni-types'HTTP & API
typescript
import type { HTTPMethod, HTTPStatus, Route, Middleware } from 'uni-types'数据库
typescript
import type { SQLType, QueryBuilder, Migration } from 'uni-types'并发
typescript
import type { Task, Pipeline, Scheduler, WorkerPool } from 'uni-types'互操作
typescript
import type {
ToTypeFest, ToTsToolbelt, IsCompatible
} from 'uni-types'测试
typescript
import type {
ExpectTrue, ExpectEqual, TypeCoverage, TypeComplexity
} from 'uni-types'断言
typescript
import type {
AssertEqual, AssertExtends, AssertKeyof, AssertNotNil,
RequireKeys, MakeOptional, RequireAtLeastOne, RequireExactlyOne,
AssertHasProperty, RequireNotNullish, RequireArray, RequireFunction
} from 'uni-types'异步工具
typescript
import type {
PromiseValue, PromiseResult, IsPromise, UnwrapPromise, WrapPromise,
PromiseSettledResult
} from 'uni-types'集合类型
typescript
import type {
TypeSet, SetAdd, SetRemove, SetHas, SetUnion, SetIntersection,
SetDifference, SetIsEmpty, SetIsSubset,
TypeMap, MapGet, MapSet, MapHas, MapDelete, MapKeys, MapValues,
ListLength, ListReverse, ListConcat, ListFilter, ListFind, ListIncludes
} from 'uni-types'对象操作
typescript
import type {
ObjectMap, ObjectFilter, ObjectPickByType, ObjectOmitByType, ObjectInvert,
DeepMerge, DeepAssign, DeepDefaults,
HasProperty, HasProperties, HasMethod
} from 'uni-types'模式匹配
typescript
import type {
Match, Case, Default, TypeFilter, TypeFind, TypeIncludes
} from 'uni-types'字符串操作
typescript
import type {
Split, Join, KebabCase, PascalCase, IsEmail, IsUUID, IsURL, Chunk
} from 'uni-types'性能优化
typescript
import type {
Simplify, DeepSimplify, Cached, CachedValue, Memoized,
Lazy, ForceEvaluate, Deferred, FlattenType,
StripNever, StripUndefined, Compact
} from 'uni-types'Schema 验证
typescript
import type {
RuntimeGuard, GuardedType, HasRuntimeCheck, CompositeGuard,
ZodOutput, ZodInput, IsZodSchema, ZodShape, ZodArrayElement,
YupOutput, YupInput, IsYupSchema
} from 'uni-types'生态系统集成
typescript
import type {
ComponentProps, PropsWithChildren, PrismaCreateInput
} from 'uni-types'权限与授权 (v1.5.0)
typescript
import type {
Permission, PermissionSet, Role, RoleSet,
Policy, PolicyRule, PolicyEffect,
RBAC, ABAC, ACL, AccessControl,
Resource, Action, AuthorizationProvider
} from 'uni-types'缓存策略 (v1.5.0)
typescript
import type {
Cache, CacheEntry, CacheOptions, CacheStats,
LRUCache, LFUCache, TTLCache, FIFOCache, ARCCache,
DistributedCache, CacheAside, ReadThroughCache,
WriteThroughCache, WriteBehindCache
} from 'uni-types'配置管理 (v1.5.0)
typescript
import type {
Config, ConfigField, ConfigLoader, ConfigSchema,
EnvConfig, FeatureFlag, FeatureFlagConfig,
RemoteConfigProvider, Secret, SecretProvider
} from 'uni-types'事件驱动架构 (v1.5.0)
typescript
import type {
EventBus, EventStream, Command, CommandBus,
Query, QueryBus, Saga, SagaStep,
MessageQueue, EventStore, DeadLetterQueue
} from 'uni-types'GraphQL 集成 (v1.5.0)
typescript
import type {
GraphQLSchema, GraphQLType, GraphQLScalar,
GraphQLEnum, GraphQLInput, GraphQLObject,
GraphQLField, GraphQLResolver, GraphQLContext,
GraphQLResult, GraphQLError
} from 'uni-types'日志与可观测性 (v1.5.0)
typescript
import type {
Logger, LogLevel, LogEntry, Metric, Counter, Gauge,
Histogram, Tracer, Span, Trace, Monitor, Alert,
HealthIndicator, HealthCheckResult
} from 'uni-types'微服务架构 (v1.5.0)
typescript
import type {
Microservice, ServiceConfig, ServiceRegistry,
ServiceInstance, CircuitBreaker, LoadBalancer,
APIGateway, HealthReport, RateLimit
} from 'uni-types'验证规则 (v1.5.0)
typescript
import type {
ValidationRule, Validator, ValidatorResult, ValidationError,
StringFieldValidator, NumberFieldValidator,
MinLength, MaxLength, MinValue, MaxValue,
Pattern, Sanitizer
} from 'uni-types'WebSocket 与实时通信 (v1.5.0)
typescript
import type {
WebSocketConfig, WebSocketMessage, EventEmitter,
PubSub, Publisher, Subscriber, RealTimeChannel,
Stream, StreamReader, StreamWriter
} from 'uni-types'工作流引擎 (v1.5.0)
typescript
import type {
Workflow, WorkflowInstance, WorkflowStep,
WorkflowTransition, WorkflowExecution, WorkflowHistory,
WorkflowEngine, RetryPolicy, BPMNProcess, BPMNTask,
BPMNGateway, BPMNEvent
} from 'uni-types'AI/ML 类型 (v1.6.0)
typescript
import type {
Tensor, TensorShape, TensorDType,
Model, ModelConfig, Layer, LayerType,
Optimizer, LossFunction, MLMetric,
Dataset, DataLoader, Batch,
InferenceResult, Prediction, Confidence
} from 'uni-types'函数式编程 (v1.6.0)
typescript
import type {
Functor, Monad, Applicative,
Maybe, Some, None, Either, Left, Right,
IO, Reader, Writer, State,
Result, Ok, Err, Lens,
Semigroup, Monoid, Compose, Pipe, Curry
} from 'uni-types'类型级编译器 (v1.6.0)
typescript
import type {
ASTNode, ASTNodeType, Token, TokenType,
Parser, ParserResult, ParseError,
CodeGenerator, GeneratedCode, SourceMap,
Transformer, Formatter
} from 'uni-types'分布式系统 (v1.6.0)
typescript
import type {
Consensus, ConsensusState, LeaderElection,
Replica, ReplicationStrategy, Partition,
PartitionStrategy, ConsistencyLevel,
DistributedLock, TwoPhaseCommit, TransactionState,
FailureDetector, Heartbeat, Membership
} from 'uni-types'安全类型 (v1.6.0)
typescript
import type {
Authentication, AuthType, AuthStatus,
Session, SessionId, Encryption, EncryptionAlgorithm,
Key, KeyPair, Hash, HashAlgorithm,
Signature, SignatureAlgorithm, JWT, OAuthToken, CSRFToken
} from 'uni-types'国际化 (v1.6.0)
typescript
import type {
Locale, LocaleCode, LanguageCode, CountryCode,
Translation, TranslationKey, PluralForm,
Currency, TimeZone, DateFormat, NumberFormat, Direction
} from 'uni-types'测试框架 (v1.6.0)
typescript
import type {
TestSuite, TestCase, TestResultType,
Assertion, AssertionResult, Mock, Spy,
Fixture, Coverage, CoverageReport,
Snapshot, Benchmark, BenchmarkResult
} from 'uni-types'插件系统 (v1.6.0)
typescript
import type {
Plugin, PluginConfig, PluginContext, PluginLifecycle,
Hook, HookResult, Extension, ExtensionPoint,
Middleware, MiddlewarePipeline, Module, Registry
} from 'uni-types'类型推断 (v1.6.0)
typescript
import type {
Infer, InferReturn, InferArgs, InferPromise,
ExtractFunction, ExtractClass, ExtractConstructor,
Reconstruct, Narrow, Widen,
IsAny, IsNever, IsUnknown, IsFunction, IsArray, IsUnion,
Equals, Extends, TypeName, TypeCategory
} from 'uni-types'性能监控 (v1.6.0)
typescript
import type {
Performance, PerformanceMetric, Timing,
MemoryUsage, MemoryMetric, CPUUsage,
Profiler, ProfileResult, TraceSpan,
PerformanceTrace, PerformanceAlert
} from 'uni-types'类型可视化 (v1.7.0)
typescript
import type {
TypeDiagram, TypeTree, TypeGraph, TypeNode,
Debug, Inspect, Pretty, TypeDiff,
GenerateDocs, DocTemplate, MarkdownOutput
} from 'uni-types'类型级密码学 (v1.7.0)
typescript
import type {
HashAlgorithm, SHA256, SHA512, MD5,
EncryptionAlgorithm, AES, RSA,
Key, KeyPair, EncryptedData, DecryptedData,
JWT, JWTPayload, JWTHeader, Signature
} from 'uni-types'类型级日期时间 (v1.7.0)
typescript
import type {
CalendarDate, DateFormat, TimeFormat,
Duration, DurationUnit, AddDays, AddMonths,
DateDiff, DateRange, Timestamp, UnixTimestamp
} from 'uni-types'类型装饰器 (v1.7.0)
typescript
import type {
Decorator, DecoratorContext, DecoratorResult,
Cached, MemoizeOptions, Memoized,
Deprecated, Experimental, Seal, Frozen,
Retry, RetryOptions, Throttle, Debounce
} from 'uni-types'代码生成模板 (v1.7.0)
typescript
import type {
Template, TemplateString, TemplateContext,
GeneratedType, GeneratedInterface, GeneratedTypeAlias,
CodeBuilder, CodeSegment, CodeBlock
} from 'uni-types'类型安全配置 (v1.7.0)
typescript
import type {
ConfigSchema, ConfigField, ConfigBuilder,
EnvConfig, EnvVar, EnvPrefix,
Secret, SecretRef, SecretProvider
} from 'uni-types'类型级高级数学 (v1.7.0)
typescript
import type {
Abs, Sqrt, Power, Log,
Fibonacci, Factorial, IsPrime, GCD, LCM,
Trigonometric, Sin, Cos, Tan
} from 'uni-types'类型级排序搜索 (v1.7.0)
typescript
import type {
QuickSort, MergeSort, BinarySearch,
SearchFind, SearchIncludes, SearchIndexOf,
Chunk, Unique, Difference, Intersection
} from 'uni-types'元编程工具 (v1.7.0)
typescript
import type {
MetaType, MetaProperty, MetaFunction,
Reflect, Satisfies, TypeAtPath,
MergeTypes, OmitTypeAtPath, PickTypeAtPath,
Transform, SetTypeAtPath, TypeInfo, TypeName
} from 'uni-types'框架集成 (v1.7.0)
typescript
import type {
// Remix
RemixLoader, RemixAction, RemixRoute, RemixLoaderData,
// Astro
AstroProps, AstroFrontmatter, AstroLayout,
// SvelteKit
SvelteKitLoad, SvelteKitAction, SvelteKitPage,
// Express
ExpressHandler, ExpressRequest, ExpressResponse,
// Fastify
FastifyHandler, FastifyRequest, FastifyReply,
// Hono
HonoHandler, HonoContext, HonoMiddleware
} from 'uni-types'类型推断引擎 (v1.8.0)
typescript
import type {
InferEngine, InferContext, InferResult, InferError,
Deduce, DeduceFrom, DeduceAll, DeduceDeep,
Constraint, Solve, Unify, Substitution,
TypeVar, FreshVar, SubstituteVar, FreeVars,
Polymorphic, Monomorphize, Instantiate, Generalize,
Kind, KindError, KindCheck, HigherKind,
Effect, EffectRow, Effectful, Pure, Handle
} from 'uni-types'类型级数据库操作 (v1.8.0)
typescript
import type {
QueryBuilder, SelectBuilder, InsertBuilder, UpdateBuilder, DeleteBuilder,
TableSchema, ColumnSchema, IndexSchema, RelationSchema,
SQLQuery, SQLExpression, SQLCondition, SQLJoin,
SelectQuery, InsertQuery, UpdateQuery, DeleteQuery,
Transaction, TransactionResult, IsolationLevel,
Migration, MigrationUp, MigrationDown, MigrationHistory,
Model, ModelRelation, ModelScope, ModelHook
} from 'uni-types'类型级网络协议 (v1.8.0)
typescript
import type {
Protocol, ProtocolVersion, ProtocolEncoding, ProtocolMessage,
HTTPRequest, HTTPResponse, HTTPHeaders, HTTPBody,
WSMessage, WSFrame, WSEvent, WSHandler,
gRPCService, gRPCMethod, gRPCRequest, gRPCResponse,
TCPPacket, UDPPacket, SocketAddress,
ProtoMessage, ProtoField, ProtoEnum, ProtoService,
MQTTPacket, MQTTTopic, MQTTPayload, MQTTQoS
} from 'uni-types'类型级文件系统 (v1.8.0)
typescript
import type {
Path, RelativePath, AbsolutePath, PathSegment,
File, FileContent, FileType, FilePermission,
Directory, DirectoryEntry, DirectoryTree, GlobPattern,
FileWatch, WatchEvent, WatchHandler,
VirtualFS, VFSNode, VFSMount,
Archive, ArchiveEntry, ArchiveFormat,
FileStats, FileMetadata, Timestamp
} from 'uni-types'类型级调试工具 (v1.8.0)
typescript
import type {
DebugInfo, DebugSymbol, DebugContext,
Breakpoint, BreakpointCondition, BreakpointAction,
StackTrace, StackFrame, CallStack,
Variable, VariableValue, VariableType,
WatchExpression, WatchResult, WatchCallback,
MemoryRegion, MemoryAddress, MemoryValue,
DebugProtocol, DebugMessage, DebugCommand, DebugEvent,
REPL, REPLCommand, REPLResult
} from 'uni-types'类型级优化器 (v1.8.0)
typescript
import type {
Optimization, OptimizationPass, OptimizationResult,
OptimizationRule, RulePattern, RuleReplacement, RuleCondition,
TreeShake, ShakeResult, UsedExports,
DeadCode, EliminateDeadCode, LiveCode,
Inline, InlineCandidate, InlineResult, InlineThreshold,
ConstantFold, FoldableExpression, FoldedValue,
MinifyType, MinificationOptions, MinifiedType,
PerformanceHint, HintLevel, HintSuggestion
} from 'uni-types'类型级文档生成器 (v1.8.0)
typescript
import type {
Documentation, DocEntry, DocSection, DocPage,
JSDoc, JSDocTag, JSDocParam, JSDocReturn, JSDocExample,
APIDoc, APIEndpoint, APIParameter, APIResponse,
TypeDoc, TypeDocProperty, TypeDocMethod, TypeDocExample,
DocOutput, DocFormat, DocTheme,
DocSearch, SearchResult, SearchIndex,
DocNavigation, DocSidebar, DocBreadcrumb
} from 'uni-types'类型级包管理器 (v1.8.0)
typescript
import type {
Package, PackageName, PackageVersion, PackageMeta,
Dependency, DependencyGraph, DependencyTree, DependencyVersion,
Resolution, ResolutionResult, ResolutionError, ResolveStrategy,
LockFile, LockEntry, LockFormat,
Registry, RegistryPackage, RegistryVersion, RegistryConfig,
Workspace, WorkspaceConfig, WorkspaceDependency, WorkspaceGraph,
PackagePlugin, PluginHook, PluginConfig,
PackageScript, ScriptRunner, ScriptResult
} from 'uni-types'量子计算类型 (v1.9.0)
typescript
import type {
QubitState, QubitAmplitude, Qubit, QubitArray,
SingleQubitGate, TwoQubitGate, ThreeQubitGate, MultiQubitGate,
Hadamard, PauliX, PauliY, PauliZ, CNOT, Toffoli,
QuantumGate, QuantumCircuit, QuantumRegister, ClassicalRegister,
QuantumState, StateVector, DensityMatrix,
BellState, GHZState, EntangledPair,
QuantumAlgorithm, Grover, Shor, QFT, VQE, QAOA,
QuantumResult, QuantumTeleportation, SuperdenseCoding,
QECCode, SurfaceCode, LogicalQubit,
QuantumBackend, QuantumHardware, QuantumJob,
BlochSphereCoordinates, Fidelity, QuantumVolume
} from 'uni-types'游戏开发类型 (v1.9.0)
typescript
import type {
EntityId, Entity, EntityComponent, EntitySystem, EntityQuery,
Component, Position2D, Position3D, Velocity, TransformComponent,
SpriteComponent, AnimationComponent, HealthComponent,
GameState, GameAction, GameReducer, GameStore,
KeyState, KeyboardState, MouseState, GamepadState,
InputState, TouchState, TouchPoint,
PhysicsBody, ColliderShape, PhysicsMaterial, Collision,
Renderable, Material, Shader, Texture, Mesh, Camera,
AudioClip, AudioSource, AudioListener, SoundEffect,
Scene, SceneNode, SceneGraph, Vector2D, Vector3D,
UIElement, UIText, UIButton, UIProgress,
GameTime, Timer, Tween, EasingFunction,
Level, SpawnPoint, Checkpoint, Objective
} from 'uni-types'区块链类型 (v1.9.0)
typescript
import type {
BlockHash, BlockHeader, BlockBody, Block, Withdrawal,
TransactionHash, TransactionType, Transaction,
LegacyTransaction, EIP2930Transaction, EIP1559Transaction, EIP4844Transaction,
TransactionSignature, AccessList, TransactionReceipt,
SmartContract, ContractABI, ABIFunction, ABIEvent, ABIParameter,
ContractMethod, ContractEvent,
Address, ChecksumAddress, PublicKey, PrivateKey, Signature,
TokenInfo, FungibleTokenBalance, TokenAllowance,
NonFungibleToken, MultiToken, TokenBalance,
WalletAccount, WalletConnectionStatus, WalletConnection, WalletProvider,
Chain, ChainId, NetworkConfig, EVMChainId,
GasEstimate, GasPrice, GasLimit, TransactionFee, GasFees,
ConsensusMechanism, ValidatorInfo, StakingInfo,
Log, LogFilter, JsonRpcProvider, JsonRpcRequest,
ContractDeployOptions, ContractDeployResult,
ENSName, ENSResolver,
PoolPair, LiquidityPool, SwapParams
} from 'uni-types'自然语言处理类型 (v1.9.0)
typescript
import type {
TokenType, Token, TokenStream, TokenizerOptions,
Sentence, Paragraph, Document, Corpus,
ParseNode, ParseTree, GrammarRule, Grammar,
DependencyRelation, DependencyRelationType,
LanguageModel, NLMTask, Vocabulary, SpecialTokens,
Embedding, EmbeddingVector, WordEmbedding, DocumentEmbedding,
SemanticRole, SemanticFrame, FrameElement,
EntityMention, EntityType, RelationMention, RelationType,
Morpheme, MorphemeType, MorphologicalFeatures, PartOfSpeech,
SentimentScore, SentimentLabel, SentimentResult, EmotionResult,
Locale, LanguagePair, TranslationResult, TranslationOptions,
NormalizationOptions, TextChunk, ChunkingOptions,
TermIndex, TermInfo, PostingListEntry,
ClassificationResult, TopicModelingResult,
QAResult, QAOptions
} from 'uni-types'图形学类型 (v1.9.0)
typescript
import type {
Color, RGB, RGBA, HSL, HSLA, HSV, HexColor, ColorFormat,
ColorStop, GradientType, Gradient,
Vector2, Vector3, Vector4, Point2D, Point3D,
Size2D, Size3D, Rect, Bounds, Ray, Plane,
Matrix2x2, Matrix3x3, Matrix4x4, Matrix4x4Flat,
TransformMatrix, DecomposedTransform, Quaternion,
Translation, Rotation, Scale, Transform,
Point, Line, LineStrip, Triangle, Quad, Polygon,
Circle, Ellipse, Rectangle, Sphere, Box, Cylinder, Cone, Capsule, Torus,
VertexAttribute, VertexBufferLayout, VertexBuffer, IndexBuffer,
UniformBuffer, StorageBuffer, GPUShaderStageFlags,
ShaderLanguage, ShaderStage, VertexShader, FragmentShader, ComputeShader,
ShaderProgram, BindGroupLayout,
TextureFormat, TextureDimension, TextureUsage,
TextureDescriptor, TextureViewDescriptor, SamplerDescriptor,
RenderPassDescriptor, ColorAttachment, DepthStencilAttachment,
RenderPipelineDescriptor, PrimitiveState, DepthStencilState,
BlendState, BlendFactor, CompareFunction,
LightType, DirectionalLight, PointLight, SpotLight, AmbientLight,
MaterialBase, PBRMaterial, UnlitMaterial, PhongMaterial
} from 'uni-types'音频处理类型 (v1.9.0)
typescript
import type {
AudioSample, AudioBufferData, AudioChannel,
SampleRate, BitDepth, SampleFormat,
WaveformType, ADSREnvelope, Envelope, WaveformOptions,
Frequency, NoteName, Octave, MIDINoteNumber, NotePitch,
MusicalInterval, SemitoneInterval,
AudioEffectBase, ReverbEffect, DelayEffect, FilterEffect,
CompressorEffect, EqualizerEffect, DistortionEffect,
ChorusEffect, FlangerEffect, PhaserEffect, TremoloEffect, LimiterEffect,
MIDINote, MIDIEvent, MIDISequence, MIDITrack,
OscillatorOptions, LFOOptions, AudioSourceNode, SynthVoice, SynthesizerPatch,
FFTResult, Spectrum, Spectrogram, WaveformAnalysis,
PitchDetectionResult, BeatDetectionResult, AudioFeatures,
AudioFormat, AudioEncodingOptions, AudioMetadata,
AudioNodeConnection, AudioGraph, AudioGraphNode,
SpatialPosition, SpatialOrientation, SpatialPannerOptions
} from 'uni-types'动画类型 (v1.9.0)
typescript
import type {
AnimationTarget, AnimationDuration, AnimationFrame, AnimationTimeline,
AnimationPlaybackState, AnimationDirection, AnimationFillMode,
AnimationBase, Animation,
KeyframeBase, Keyframe, KeyframeInterpolation, KeyframeSequence,
EasingFunction, EasingType, EasingPreset, CubicBezier, StepsEasing,
Transition, TransitionProperty, TransitionDuration, TransitionShorthand,
SpringConfig, SpringState, SpringPreset,
SpriteSheet, SpriteFrame, SpriteAnimationDef, SpriteAnimation,
MorphTarget, MorphWeights, MorphAnimation,
Skeleton, Bone, BoneTransform, Joint, Pose,
AnimationState, AnimationTransition, AnimationLayer,
AnimationBlendTree, AvatarMask,
IKChain, IKTarget, IKSolverType, IKSolverConfig,
AnimationTrack, ExtrapolationMode, AnimationClip, AnimationEvent,
AnimationController, AnimationParameters, AnimationParameterValue,
InterpolateFunction, AnimationOptions
} from 'uni-types'错误处理类型 (v1.9.0)
typescript
import type {
ErrorType, ErrorMessage, ErrorStack, ErrorCode, ErrorBase,
CustomError, ErrorSeverity,
Result, Success, Failure, Ok, Err, ResultMatcher, AsyncResult,
Try, TryResult, TryCatchResult, CatchHandler, FinallyHandler,
Either, Left, Right, EitherMatcher,
Option, Some, None, OptionMatcher, NullableOption,
ErrorChain, ChainLink, ChainContext,
RecoveryStrategy, RecoveryOptions, RecoveryResult, RetryConfig,
ValidationError, ValidationErrors, FieldError, ValidationResult,
NetworkError, AuthenticationError, AuthorizationError,
NotFoundError, ConflictError, TimeoutError, RateLimitError,
ErrorHandler, GlobalErrorHandler, ErrorBoundaryProps,
ErrorFactory, ErrorInstance, ErrorLog,
AssertionResult, AssertionFunction, AssertionError,
Panic, FatalError, ExpectedErrors, BusinessError, SystemError
} from 'uni-types'事件系统类型 (v1.9.0)
typescript
import type {
EventType, EventPayload, EventTimestamp, EventId,
Event, TypedEvent, EventMap, EventConstructor,
EventEmitter, EventHandler, EventListener, EventSubscription,
EventBus, BusEvent, BusSubscription, EventBusMiddleware,
EventDispatcher, DispatchResult, DispatchError,
EventQueue, QueuedEvent, QueuePriority, QueueConfig,
Subscription, SubscriptionOptions, SubscriptionGroup,
EventPattern, PatternMatch, PatternMatcher, PatternSubscription,
EventAggregator, AggregatedEvent, AggregationType,
EventHistory, HistoryEntry, ReplayOptions, ReplayResult,
PropagationPhase, PropagationPath, PropagationController,
SyncEventHandler, AsyncEventHandler, ConditionalHandler,
EventTarget, DomainEvent, DomainEventHandler,
HandlerDecoratorOptions, EventMetadata,
EventNameFromHandler, PayloadFromEvent, EventHandlerMap
} from 'uni-types'响应式编程类型 (v1.9.0)
typescript
import type {
Observable, Observer, PartialObserver, Subscription,
Subject, BehaviorSubject, ReplaySubject, AsyncSubject,
OperatorFunction, UnaryFunction, OperatorName,
MapOperator, FilterOperator, ReduceOperator,
TakeOptions, DebounceOptions, ThrottleOptions, RetryOptions,
Stream, StreamValue, StreamError,
Signal, ReadonlySignal, WritableSignal, SignalValue,
Computed, Effect, EffectOptions, SignalOptions,
Scheduler, SchedulerAction, SchedulerLike,
BackpressureStrategy, BackpressureConfig, BackpressureState,
Flow, FlowState, FlowController, ColdFlow, HotFlow,
Channel, ChannelBuffer, BufferedChannel, SelectableChannel,
CombineLatest, Zip, ForkJoinResult,
ReactivePrimitive, ReactiveValue, ReactiveStore,
StoreAction, StoreReducer, StoreMiddleware,
FromEvent, FromPromise, IntervalObservable, TimerObservable
} from 'uni-types'依赖类型模拟 (v2.0.0)
typescript
import type {
Dep, DepValue, DepIndex, DepKey,
ValueOf, Where, SuchThat, Satisfies, Exactly,
Proof, Prove, Verified, Unverified,
Refined, Refine, Unrefine,
AssertType, AssertShape, AssertKeys, AssertValues,
TypeEq, TypeNotEq, TypeExtends, TypeCompatible,
DepIf, DepMatch, DepFmap, DepCompute
} from 'uni-types'
// ── 核心:类型依赖于值的依赖类型 ──
type StrictNum = Dep<number, number> // number
type Mismatch = Dep<string, number> // never
// ── 值依赖:将类型锁定为特定字面量 ──
type TrueFlag = DepValue<boolean, true> // true
type Port80 = DepValue<number, 80> // 80
// ── 索引依赖:元组级别查找 ──
type Second = DepIndex<['a', 'b', 'c'], 1> // 'b'
// ── 键依赖:属性级别访问 ──
type Age = DepKey<{ name: string; age: number }, 'age'> // number
// ── 条件收窄 ──
type NonEmpty = Where<string, string> // string(收窄)
type Numeric = SuchThat<number, number> // number(收窄)
// ── 精确匹配 — 不允许多余属性 ──
type Exact = Exactly<{ name: string }, { name: string }> // { name: string }
type Reject = Exactly<{ name: string; x: number }, { name: string }> // never
// ── 证明携带类型 ──
type EmailProof = Prove<string, 'Email'> // Proof<string, 'Email'>
type VerifiedUser = Verified<User> // User & { __verified__: true; __verifiedAt__: number }
type RawUser = Unverified<VerifiedUser> // User
// ── 精化类型 ──
type PositiveInt = Refined<number, (x: number) => x is number>
type EmailStr = Refine<string, 'Email'> // string & { __refinement__: 'Email' }
type Plain = Unrefine<EmailStr> // string
// ── 类型级别相等性 ──
type Same = TypeEq<string, number> // false
type NotSame = TypeNotEq<string, number> // true
type Extends = TypeExtends<'hi', string> // true
// ── 类型级别计算 ──
type IfTrue = DepIf<true, 'yes', 'no'> // 'yes'
type AdminRole = DepMatch<'admin', { admin: 'full'; user: 'limited'; default: 'none' }> // 'full'类型级宏 (v2.0.0)
typescript
import type {
Macro, MacroRule, MacroExpand, MacroExpandAll,
Inline, Specialize, Generic, Template,
DefineMacro, LoadMacro, CombineMacro,
RewriteRule, ApplyRule, ApplyRules,
MacroCompose, MacroPipe, MacroFlip, MacroPartial,
MacroDebug, MacroTrace
} from 'uni-types'
// ── 定义重写规则 ──
type Stringify = MacroRule<string, `value:${string}`>
type Numerify = MacroRule<number, 'num'>
type Boolify = MacroRule<boolean, 'bool'>
// ── 单步扩展 ──
type Ex1 = MacroExpand<string, [Stringify, Numerify]> // `value:${string}`
type Ex2 = MacroExpand<number, [Stringify, Numerify]> // 'num'
// ── 完全扩展直到不动点 ──
type Fully = MacroExpandAll<MyType, [Stringify, Numerify]>
// ── 内联:展平交叉类型 ──
type Flat = Inline<{ a: string } & { b: number }> // { a: string; b: number }
// ── 特化泛型类型 ──
type Ret = Specialize<(x: string) => number, [string]> // number
// ── 定义和加载宏 ──
type MacroDef = DefineMacro<{
name: 'StringifyAll'
parameters: ['T']
body: MacroExpandAll<unknown, [Stringify]>
rules: [Stringify]
}>
type Ready = LoadMacro<MacroDef>
// ── 组合与管道 ──
type Comp = MacroCompose<MacroA, MacroB>
type Pipe = MacroPipe<Input, [MacroA, MacroB, MacroC]>
// ── 翻转与偏应用 ──
type Flip = MacroFlip<A, B> // [B, A]
type Part = MacroPartial<MacroA, { name: string }> // 偏应用
// ── 调试与追踪 ──
type Dbg = MacroDebug<string> // { _original, _expanded, _steps, _rulesApplied }
type Trc = MacroTrace<string, [Stringify]> // 调试信息 + 最终结果模块系统 (v2.0.0)
typescript
import type {
Module, Export, Import, ReExport,
Namespace, Qualified, Alias,
ModuleGraph, ModuleNode, ModuleDependency, DependencyType,
ModuleResolution, ResolutionStrategy,
ModuleScope, ScopedMember,
ModuleBundle, BundleFormat, ModuleChunk,
ModuleVersion, VersionCompatibility
} from 'uni-types'
// ── 定义类型级模块 ──
type UserModule = Module<{
User: { id: string; name: string; email: string }
UserService: { findById(id: string): User }
}>
// ── 通过命名空间限定访问 ──
type NS = Namespace<{ User: { id: string }; Service: { find(): void }>
type U = Qualified<NS, 'User'> // { id: string }
type S = Qualified<NS, 'Service'> // { find(): void }
// ── 导出 / 导入 / 重新导出 ──
type Exp = Export<User> // User & { __exported__: true }
type Imp = Import<Utils> // Utils & { __imported__: true; __from__: string }
type ReExp = ReExport<External> // 从另一个模块重新导出
// ── 类型别名 ──
type UserName = Alias<string, 'UserName'> // string & { __alias__: 'UserName' }
// ── 作用域可见性 ──
type Public = ScopedMember<{ api: API }, {
scope: ModuleScope // 'public' | 'protected' | 'private' | 'internal'
deprecated: false
since: '2.0.0'
}>
// ── 版本控制 ──
type V2 = ModuleVersion<{ major: 2; minor: 0; patch: 0 }>
type Compat = VersionCompatibility // 'compatible' | 'semver-compatible' | 'breaking' | 'unknown'性能架构 (v2.0.0)
typescript
import type {
Fast, Cached, Lazy, Memoized, NoInfer,
Optimized, InlineHint, Preserve,
Precompute, PrecomputedValue,
ReduceComplexity, SimplifyForCompiler, OptimizeInference,
LightWeight, Minimal, CompactRepresentation, SharedStructure,
TypeHint, PerformanceHint, CompilerHint, HintKind,
TypeComplexity, CompilationTime, TypeSize,
PerformanceWarning, IncrementalType, DeferredEvaluation
} from 'uni-types'
// ── 性能原语 ──
type FastUser = Fast<User> // 展平交叉类型和数组
type CachedResult = Cached<ComplexComputation> // 缓存类型计算
type Deferred = Lazy<DeepNestedType> // 延迟求值
type Memo = Memoized<HeavyType> // 记忆化昂贵计算
// ── 优化标记 ──
type Opt = Optimized<User> // 标记为已优化
function cfg<T>(c: NoInfer<T>): T { return c } // 阻止推断
type Preserved = Preserve<readonly ['a', 'b']> // 阻止类型扩展
// ── 编译器提示 ──
type Hinted = TypeHint<Data, 'cache'> // 附加缓存提示
// HintKind = 'optimize' | 'inline' | 'cache' | 'defer' | 'noinfer'
// ── 编译优化 ──
type Pre = Precompute<{ a: string } & { b: number }> // { a: string; b: number }
type Simpler = ReduceComplexity<{ deeply: { nested: { type: string } } }>
// ── 内存优化 ──
type Light = LightWeight<Config> // 轻量级标记
type Min = Minimal<Config> // 仅保留函数成员
type Compact = CompactRepresentation<Data> // 紧凑表示
type Shared = SharedStructure<ConfigA, ConfigB> // 共享键/值
// ── 构建性能 ──
type DefEval = DeferredEvaluation<HeavyType> // 延迟到首次使用
type Incr = IncrementalType<User> // 增量类型检查
// → User & { __incremental__: true; __version__: number }
// ── 性能监控 ──
type C = TypeComplexity<User> // 1 | 2 | 3
type T = CompilationTime<User> // 'fast' | 'moderate' | 'slow'
type S = TypeSize<User> // 'small' | 'medium' | 'large'迁移工具包 (v1.13.0)
typescript
import type {
MigrationToolkit, MigrationPlan, MigrationStep,
MigrationReport, CodemodConfig, MigrationValidator, RollbackPlan
} from 'uni-types'v2.0.0 测试版功能 (v1.13.0)
typescript
import type {
V2BetaFeature, BetaAPI, PreviewType,
BetaConfig, MigrationPreview, BetaFeedback, V2CompatibilityLayer
} from 'uni-types'最终破坏性变更 (v1.13.0)
typescript
import type {
BreakingChange, BreakingChangeRegistry, DeprecationNotice,
ImpactAssessment, ChangeCategory, BreakingChangeGuard, MigrationAutomator
} from 'uni-types'双模式支持 (v1.13.0)
typescript
import type {
DualMode, ModeConfig, StrictMode, LenientMode,
ModeTransition, ModeDetector, ModeCompatibility
} from 'uni-types'最终性能优化 (v1.13.0)
typescript
import type {
FinalOptimized, CompilationProfile, PerformanceBudget,
LazyInference, BatchEvaluation, MemoryOptimized,
CacheStrategy, PerformanceReport
} from 'uni-types'社区与生态 (v1.13.0)
typescript
import type {
CommunityPlugin, PluginRegistry, ContributionGuide,
EcosystemIntegration, CommunityFeedback, PluginAPI,
GovernanceModel, ReleaseCoordination
} from 'uni-types'最终文档 (v1.13.0)
typescript
import type {
FinalDocConfig, TypeDocumentation, VersionedDoc,
DocIndex, DocValidation, DocTemplate, APIReference
} from 'uni-types'最终稳定性与打磨 (v1.13.0)
typescript
import type {
StabilityReport, StabilityLevel, PolishResult,
RegressionTest, EdgeCase, TypeAudit,
ProductionReadiness, QualityScore
} from 'uni-types'生命周期终止规划 (v1.13.0)
typescript
import type {
EOLTimeline, EOLPolicy, DeprecationSchedule,
MigrationDeadline, EOLNotification, LifecycleState,
SunsetPlan, LegacySupport
} from 'uni-types'v2.0.0 发布准备 (v1.13.0)
typescript
import type {
LaunchChecklist, ReleasePlan, RolloutStrategy,
ReleaseNotes, LaunchCoordination, CompatibilityMatrix,
PostLaunchMonitor, LaunchReadiness
} from 'uni-types'示例代码
以下是一个展示各种功能的综合示例:
typescript
import type {
PickRequired, DeepPartial, DeepReadonly, Sort, GCD, Factorial,
IsArray, IsTuple, IsEqual, ObjectPickByType, Split, Join,
CamelCase, SnakeCase, Paths, PathValue, AssertEqual,
Microservice, ServiceConfig, CircuitBreaker, Cache,
LRUCache, EventBus, Saga, Logger, LogLevel,
Workflow, WorkflowStep, RBAC, Permission, Role,
// v1.6.0
Tensor, Model, Layer, Optimizer,
Maybe, Either, Result, Lens,
Infer, InferReturn, Equals, TypeName,
// v1.7.0
TypeDiagram, TypeTree, Debug, Inspect, Pretty,
HashAlgorithm, SHA256, EncryptionAlgorithm, Key,
CalendarDate, DateFormat, Duration, AddDays,
Decorator, Cached, Memoized, Deprecated,
Template, TemplateString, GeneratedType,
ConfigSchema, ConfigBuilder, EnvConfig,
RemixLoader, SvelteKitLoad, ExpressHandler,
Abs, Sqrt, Power, Fibonacci, IsPrime
} from 'uni-types'
// 核心操作 - 将属性变为必需
interface User {
name?: string
age?: number
email: string
}
type RequiredUser = PickRequired<User, 'name' | 'age'>
// 深度操作 - 嵌套对象可选
interface Config {
database: {
host: string
port: number
credentials: {
user: string
password: string
}
}
}
type PartialConfig = DeepPartial<Config>
// 类型级别算法
type SortedNumbers = Sort<[3, 1, 4, 1, 5, 9, 2, 6]>
type GcdResult = GCD<48, 18>
type FactorialResult = Factorial<5>
// 类型判断
type ArrayCheck = IsArray<string[]>
type TupleCheck = IsTuple<[1, 2, 3]>
type EqualCheck = IsEqual<string, string>
// 对象操作 - 按类型选取
interface MixedObject {
name: string
count: number
active: boolean
callback: () => void
}
type OnlyStrings = ObjectPickByType<MixedObject, string>
type OnlyNumbers = ObjectPickByType<MixedObject, number>
// 字符串操作
type SplitResult = Split<'a-b-c', '-'>
type JoinResult = Join<['a', 'b', 'c'], '-'>
type CamelResult = CamelCase<'hello-world'>
type SnakeResult = SnakeCase<'helloWorld'>
// 路径工具
type AllPaths = Paths<{ a: { b: { c: string } } }>
type ValueAtPath = PathValue<{ a: { b: { c: string } } }, 'a.b.c'>
// 类型断言 - 编译时验证
type TestAssertion = AssertEqual<string, string> // string
type TestAssertion2 = AssertEqual<string, number> // never
// 验证阶乘
type VerifyFactorial = AssertEqual<Factorial<5>, 120>
// v1.5.0 - 微服务架构
const orderService: Microservice = {
name: 'order-service',
version: '1.0.0',
config: {
name: 'order-service',
version: '1.0.0',
port: 3000,
host: '0.0.0.0',
env: 'production'
},
start: async () => { /* 启动服务器 */ },
stop: async () => { /* 优雅关闭 */ },
health: async () => ({ status: 'healthy', timestamp: new Date(), service: 'order-service', version: '1.0.0', uptime: 0, checks: {} })
}
// v1.5.0 - RBAC 权限控制
interface AppPermission extends Permission<'orders:read' | 'orders:write' | 'users:admin'> {
resource: 'orders' | 'users'
action: 'create' | 'read' | 'update' | 'delete'
}
// v1.5.0 - 日志配置
const loggerConfig: LoggerConfig = {
level: 'info',
format: 'json',
transports: [{ type: 'console' }]
}
// v1.6.0 - AI/ML 类型
type ImageTensor = Tensor<[224, 224, 3], 'float32'>
type CNNModel = Model<ImageTensor, { label: string; confidence: number }>
// v1.6.0 - 函数式编程
type OptionalValue = Maybe<string> // Some<string> | None
type ValidationResult = Either<Error, string> // Left<Error> | Right<string>
type OperationResult = Result<Data, Error> // Ok<Data> | Err<Error>
// v1.6.0 - 类型推断
type PromiseValue = Infer<Promise<string>> // string
type ReturnValue = InferReturn<() => number> // number
type AreEqual = Equals<string, string> // true
type Name = TypeName<number> // 'number'
// v1.7.0 - 类型可视化
type DebugUser = Debug<User>
type PrettyConfig = Pretty<Config>
type DiffResult = TypeDiff<{ a: string }, { a: string; b: number }>
type Doc = GenerateDocs<User>
// v1.7.0 - 密码学类型
interface SecureToken extends JWT<{ userId: string; role: string }> {}
type HashAlgo = HashAlgorithm // 'sha256' | 'sha512' | ...
type EncryptedPayload = EncryptedData<'aes-256-gcm'>
// v1.7.0 - 日期时间类型
type Today = CalendarDate<'gregorian'>
type Formatted = DateFormat<'YYYY-MM-DD'>
type Added = AddDays<'2024-01-01', 7>
type Duration2 = Duration<'2h30m'>
// v1.7.0 - 装饰器类型
const memoConfig: MemoizeOptions = { ttl: 60000 }
const retryConfig: RetryOptions = { maxRetries: 3, delay: 1000 }
// v1.7.0 - 配置构建器
interface AppConfig extends ConfigSchema<{
port: ConfigField<number>
host: ConfigField<string>
debug: ConfigField<boolean>
}> {}
// v1.7.0 - 框架集成
type RemixData = RemixLoaderData<RemixRoute<{ user: User }, never>>
type ExpressReq = ExpressRequest<{ id: string }, { name: string }>
type SvelteData = SvelteKitPage<{ slug: string }, { post: Post }>
// v1.7.0 - 高级数学
type AbsValue = Abs<-5> // 5
type SqrtValue = Sqrt<16> // 4
type FibResult = Fibonacci<10> // 55
type PrimeCheck = IsPrime<17> // true
// v1.7.0 - 排序搜索
type SortedTuple = QuickSort<[3, 1, 4, 1, 5]>
type Found = SearchFind<[{ a: 1 }, { b: 2 }], { b: 2 }>
type Chunks = Chunk<[1, 2, 3, 4, 5], 2>
// v1.8.0 - 类型推断引擎
interface InferContext {
typeVars: Map<string, TypeVar>
constraints: Constraint[]
}
type InferredType = Deduce<{ a: string; b: number }>
type Unified = Unify<string, number>
// v1.8.0 - 网络协议
interface APIRequest extends HTTPRequest<{ method: 'GET' }, { page: number }> {}
interface WebSocket extends WSMessage<{ type: 'text' }, { data: string }> {}
// v1.8.0 - 文件系统
type ConfigPath = Path<'src/config/index.ts'>
type SourceFile = File<{ content: string; encoding: 'utf-8' }>
type ProjectTree = DirectoryTree<{ src: { index: File<{ content: string }> } }>
// v1.8.0 - 调试
interface DebugSession {
breakpoints: Breakpoint[]
callStack: CallStack
variables: Map<string, Variable>
}
// v1.8.0 - 优化器
interface OptimizationPass {
name: string
rules: OptimizationRule[]
enabled: boolean
}
// v1.8.0 - 文档生成器
interface TypeDocumentation extends TypeDoc<{
description: string
params: Record<string, string>
returns: string
}> {}
// v1.8.0 - 包管理器
interface ProjectWorkspace extends Workspace<{
packages: Map<string, Package>
dependencies: DependencyGraph
}> {}
// v1.9.0 - 量子计算
type QuantumState = QubitState<{ alpha: number; beta: number }>
type BellPair = BellState<'phi_plus'>
type GateApplied = ApplyGate<Hadamard, Qubit>
// v1.9.0 - 游戏开发
type GameEntity = Entity<{ position: Vector2D; velocity: Vector2D }>
type PhysicsBody = RigidBody<{ mass: number; friction: number }>
type Sprite = SpriteComponent<{ texture: string; width: number }>
// v1.9.0 - 区块链
type Transaction1559 = EIP1559Transaction<{ gasLimit: number; maxFeePerGas: string }>
type ERC20Balance = FungibleTokenBalance<{ address: string; amount: string }>
type WalletState = WalletConnectionStatus
// v1.9.0 - 语言处理
type NLPDocument = Document<{ tokens: Token[]; sentences: Sentence[] }>
type Sentiment = SentimentResult<{ score: number; label: SentimentLabel }>
type Translation = TranslationResult<{ source: string; target: string }>
// v1.9.0 - 图形渲染
type ColorRGBA = RGBA<{ r: 255; g: 128; b: 64; a: 1 }>
type Transform3D = Transform<{ position: Vector3; rotation: Quaternion }>
type ShaderProgram = ShaderProgram<{ vertex: string; fragment: string }>
// v1.9.0 - 音频处理
type AudioWaveform = WaveformOptions<{ type: 'sine'; frequency: 440 }>
type MIDINoteOn = MIDINoteOnEvent<{ note: 60; velocity: 100 }>
type AudioAnalysis = FFTResult<{ frequencies: number[]; magnitudes: number[] }>
// v1.9.0 - 动画系统
type KeyframeSequence = KeyframeSequence<{ time: number; value: number }[]>
type AnimationTimeline = AnimationTimeline<{ duration: number; keyframes: Keyframe[] }>
type EasedValue = EasingFunction<'ease-in-out', number>
// v1.9.0 - 错误处理
type ChainError = ErrorChain<{ errors: Error[]; context: unknown }>
type Recovery = RecoveryOptions<{ strategy: 'retry'; maxAttempts: number }>
type PanicError = Panic<{ message: string; code: number }>
// v1.9.0 - 事件系统
type EventEmitter = EventEmitter<{ click: MouseEvent; keydown: KeyboardEvent }>
type EventBus = EventBus<{ userCreated: { id: string }; orderPlaced: { orderId: string } }>
type DomainEvt = DomainEvent<{ orderId: string }, { status: string }>
// v1.9.0 - 响应式编程
type ObservableStream = Observable<{ value: string; timestamp: number }>
type SignalState = WritableSignal<{ count: number }>
type BehaviorSubjectState = BehaviorSubject<{ initialValue: string }>v1.10.0 类型
typescript
// v1.10.0 - 极致类型工具
type PerfectUser = Perfect<{ name?: string; age: number }>
type CompleteConfig = Complete<{ host?: string | null; port: number | undefined }>
type FinalOptions = Final<{ debug?: boolean; timeout?: number | null }>
type UltimateState = Ultimate<{ config?: { value?: string }; count: number | null }>
type Validated = Validate<{ name: 'John'; age: 30 }, { name: string; age: number }>
// v1.10.0 - 高阶类型
type MaybeKind = Kind<{ _A?: unknown }, string>
type EitherKind = Kind2<{ _A?: unknown; _B?: unknown }, string, number>
type Composed = Compose<(n: number) => boolean, (s: string) => number>
type Piped = Pipe<(s: string) => number, (n: number) => boolean>
type ChurchBool = ChurchBoolean
type MaybeType = Maybe<string>
// v1.10.0 - 框架集成
type AngularComp = AngularComponent<{ selector: string; inputs: { value: string } }>
type SvelteStore = SvelteStore<string>
type PreactFunc = PreactFC<{ value: string }>
type SolidSignal = SolidSignal<string>
type LitEl = LitElement<{ properties: { value: string } }>
type StencilComp = StencilComponent<{ props: { value: string }; state: { count: number } }>
type AlpineData = AlpineComponent<{ data: { value: string }; methods: { increment(): void } }>
// v1.10.0 - 构建工具
type WebpackConf = WebpackConfig<{ entry: string; output: { path: string } }>
type ViteConf = ViteConfig<{ plugins: VitePlugin[]; build: ViteBuild }>
type RollupConf = RollupConfig<{ input: string; output: RollupOutput }>
type ESBuildOpts = ESBuildOptions<{ bundle: true; minify: true }>
type BabelConf = BabelConfig<{ presets: string[]; plugins: string[] }>
type SWCConf = SWCConfig<{ jsc: { parser: SWCParser } }>
// v1.10.0 - DevOps
type DockerComposeConf = DockerCompose<{ services: Record<string, DockerComposeService> }>
type K8sDeploy = K8sDeployment<{ metadata: { name: string }; spec: unknown }>
type K8sSvc = K8sService<{ spec: { ports: K8sServicePort[] } }>
type TerraformRes = TerraformResource<{ type: string; name: string }>
type AnsiblePlay = AnsiblePlaybook<{ name: string; hosts: string; tasks: AnsibleTask[] }>
type GitHubWF = GitHubWorkflow<{ name: string; jobs: Record<string, GitHubJob> }>
type GitLabPipe = GitLabPipeline<{ stages: string[] }>
// v1.10.0 - 质量保证
type ESLintConf = ESLintConfig<{ rules: Record<string, unknown> }>
type PrettierConf = PrettierConfig<{ printWidth: number; semi: boolean }>
type SecurityAudit = SecurityAudit<{ vulnerabilities: Vulnerability[] }>
type DepAudit = DependencyAudit<{ dependencies: DependencyInfo[] }>
type PerfAudit = PerformanceAudit<{ metrics: PerformanceMetric[] }>
type BundleAnal = BundleAnalysis<{ bundles: BundleInfo[] }>
type QualityGate = QualityGate<{ conditions: GateCondition[] }>
// v1.10.0 - 架构模式
type EntityT = Entity<{ id: string; props: { name: string } }>
type UseCaseT = UseCase<{ input: string }, { output: number }>
type PortT = Port<{ type: 'inbound'; methods: { execute(): void } }>
type AggregateT = Aggregate<{ root: Entity; entities: unknown[] }>
type CommandT = Command<'CreateUser', { name: string; email: string }>
type QueryT = Query<'GetUser', { id: string }>
type BoundedCtx = BoundedContext<{ name: string }>
type EventStreamT = EventStream<{ events: DomainEvent[] }>
// v1.10.0 - 数据格式
type JSONVal = JSONValue
type JSONSchemaT = JSONSchema<{ type: 'object'; properties: unknown }>
type XMLNodeT = XMLNode<{ name: string; attributes: unknown }>
type CSVRowT = CSVRow<{ name: string; value: number }>
type TOMLVal = TOMLValue<{ type: 'string'; value: string }>
type ProtoMsg = ProtoMessage<{ name: string; fields: ProtoField[] }>
type AvroSchemaT = AvroSchema<{ type: 'record'; fields: AvroField[] }>
// v1.10.0 - 无障碍访问
type ARIARoleT = ARIARole
type AriaProps = AccessibilityProps<{ role: 'button'; 'aria-label': string }>
type FocusTrapT = FocusTrap<{ enabled: boolean; container: HTMLElement }>
type KeyNav = KeyboardNavigation<{ orientation: 'vertical'; loop: true }>
type ColorContrastT = ColorContrast<{ foreground: string; background: string }>
type MotionPref = MotionPreference
type AccNodeT = AccessibilityNode<{ role: 'button'; name: string }>
// v1.10.0 - 最终优化
type Optimized = Optimize<{ a?: string | undefined }>
type Simplified = SimplifyAll<{ a: string } & { b: number }>
type Deduped = RemoveDuplicates<['a', 'b', 'a', 'c']>
type Compacted = Compact<{ a?: string; b: number }>
type Debugged = DebugType<{ a: string; b?: number }>
type FrozenT = Freeze<{ a: string }>
type ImmutableT = Immutable<{ a: { b: string } }>
type IsAnyT = IsAny<any>
type IsNeverT = IsNever<never>
type IsArrayT = IsArray<string[]>
type EqualsT = Equals<string, string>v1.11.0 类型
typescript
// v1.11.0 - 迁移工具
type MigrationStatusT = MigrationStatus
type MigrationResultT = MigrationResult<{ a: string }>
type MigratedV2 = MigrateToV2<{ oldProp: string }>
type MigratedV1 = MigrateFromV1<{ newProp: string }>
type RenameProp = RenameType<{ oldName: string }, 'oldName', 'newName'>
type CompatV1T = CompatV1<{ legacy: string }>
type CompatV2T = CompatV2<{ modern: string }>
type BackportT = Backport<{ feature: string }, '1.11.0'>
type ValidateMig = ValidateMigration<{ a: string }, { a: string }>
type MigrationComplex = MigrationComplexity
type CodemodT = Codemod<{ transform: string }>
type MigrationStepT = MigrationStep<{ input: string }>
type MigrationPathT = MigrationPath<{ from: string }, { to: string }>
// v1.11.0 - 废弃管理
type DeprecatedT = Deprecated<{ legacy: string }, 'Use NewType instead'>
type DeprecatedSinceT = DeprecatedSince<{ old: string }, '1.10.0'>
type WillBeRemovedT = WillBeRemoved<{ removed: string }, '2.0.0'>
type LegacyT = Legacy<{ backwards: string }>
type LegacyAliasT = LegacyAlias<{ old: string }, 'NewAlias'>
type DeprecationWarn = DeprecationWarning<{ type: string }>
type VersionGateT = VersionGate<{ versioned: string }, '1.0.0', '2.0.0'>
type RemovedInT = RemovedIn<{ gone: string }, '2.0.0'>
type IntroducedInT = IntroducedIn<{ new: string }, '1.11.0'>
type SunsetT = Sunset<{ ending: string }>
type SunsetScheduleT = SunsetSchedule<{ lifecycle: string }>
type EndOfLifeT = EndOfLife<{ deprecated: string }>
type DeprecationLevelT = DeprecationLevel
// v1.11.0 - 性能优化
type FastT = Fast<{ a: string } & { b: number }>
type OptimizedT = Optimized<ComplexType>
type CachedCompT = CachedCompute<string>
type LazyCompT = LazyCompute<string>
type ReduceComplexT = ReduceComplexity<{ nested: { deep: { type: string } } }>
type SimplifyCompilerT = SimplifyForCompiler<{ a: string } & { b: number }>
type LightWeightT = LightWeight<{ heavy: string }>
type MinimalT = Minimal<{ a: string; b?: undefined }>
type SharedStructT = SharedStructure<{ shared: string }>
type PooledT = Pooled<{ reusable: string }>
type PrecomputeT = Precompute<{ complex: string }>
type BuildHintT = BuildHint<{ optimized: string }>
type TypeComplexMetrics = TypeComplexityMetrics<{ complex: string }>
type PerfHintT = PerformanceHint<{ slow: string }>
type OptimizationStrat = OptimizationStrategy
type OptimizationLvl = OptimizationLevel
// v1.11.0 - 增强错误消息
type DetailedErrT = DetailedError<{ error: string }>
type ErrorCategoryT = ErrorCategory
type TypedErrT = TypedError<'type'>
type DiagnosticT = Diagnostic<{ issue: string }>
type DiagnosticSevT = DiagnosticSeverity
type TypeMismatchT = TypeMismatch<string, number>
type MissingPropT = MissingProperty<{ a: string }, 'b'>
type InvalidTypeT = InvalidType<string, number>
type RecoverableErrT = RecoverableError<{ recoverable: string }>
type RecoveryStratT = RecoveryStrategy
type FallbackT = FallbackType<string | undefined, string>
type GracefulDegradT = GracefulDegradation<{ degraded: string }>
type HelpMsgT = HelpMessage<{ help: string }>
type QuickFixT = QuickFix<{ fixable: string }>
type QuickFixActionT = QuickFixAction
type CommonErrorT = CommonErrorType
type ErrorReportT = ErrorReport
// v1.11.0 - 破坏性变更检测
type BreakingChangeT = BreakingChange
type BreakingChangeTypeT = BreakingChangeType
type BreakingChangeSevT = BreakingChangeSeverity
type APIDiffT = APIDiff<{ old: string }, { new: string }>
type AddedAPIT = AddedAPI<{ added: string }>
type RemovedAPIT = RemovedAPI<{ removed: string }>
type CompatibilityCheckT = CompatibilityCheck<{ a: string }, { a: number }>
type CompatibilityLvlT = CompatibilityLevel
type MigrationEffortT = MigrationEffort
type ImpactScopeT = ImpactScope
type RiskLevelT = RiskLevel
type ImpactAnalysisT = ImpactAnalysis
type VersionChangelogT = VersionChangelog
type BreakingChangeGuardT = BreakingChangeGuardv1.12.0 类型
typescript
// v1.12.0 - 实验性 v2 功能
type ExpFeature = Experimental<{ value: string }>
type UnstableFeature = Unstable<{ value: string }>
type PreviewFeature = Preview<{ value: string }>
type BetaFeatureV2 = Beta<{ value: string }>
type V2Preview = V2_Preview<{ value: string }>
type V2Exp = V2_Experimental<{ value: string }>
type FeatureFlagT = FeatureFlag<{ value: string }, 'new-feature'>
type FeatureGateT = FeatureGate<{ value: string }, true>
type TryExp = TryFeature<{ value: string }, true>
type OptIn = OptInFeature<{ value: string }, true>
type StabilityT = StabilityLevel
type StableFeat = StableFeature<{ value: string }>
// v1.12.0 - 统一类型系统
type TypeV2T = TypeV2<{ name: string }>
type OpsV2T = OpsV2<{ name: string }>
type PickReqV2 = PickRequiredV2<{ name?: string; age?: number }, 'name'>
type DeepPartialV2T = DeepPartialV2<{ a: { b: { c: string } } }>
type DeepReadonlyV2T = DeepReadonlyV2<{ a: { b: string } }>
type DeepRequiredV2T = DeepRequiredV2<{ a?: { b?: string } }>
type UnifiedPickT = UnifiedPick<{ a: string; b: number }, 'a'>
type UnifiedMergeT = UnifiedMerge<{ a: string }, { b: number }>
type UnifiedDeepMergeT = UnifiedDeepMerge<{ a: { x: string } }, { a: { y: number } }>
type IsEqualV2T = IsEqualV2<string, string>
type TypeBuilderT = TypeBuilderV2<{ name: string }>
type V1CompatT = V1Compat<{ value: string }>
// v1.12.0 - 高阶类型预览
type HKTApply = HKTV2<{ _type: unknown }, string>
type KindV2T = KindV2<(a: string) => number, string>
type ApplyV2T = ApplyV2<(a: string) => number, string>
type ConstructV2T = ConstructV2<(a: string, b: number) => boolean, [string, number]>
type FunctorV2T = FunctorV2<{ _type: unknown }>
type MonadV2T = MonadV2<{ _type: unknown }>
type ApplicativeV2T = ApplicativeV2<{ _type: unknown }>
type HKTId = HKTIdentity<string>
type HKTConstT = HKTConst<string, number>
type HKTComposeT = HKTCompose<F, G, string>
// v1.12.0 - 效果系统
type EffectT = EffectV2<string, ['io']>
type PureT = PureV2<string>
type IOV2T = IOV2<string>
type TrackedT = TrackEffect<PureV2<string>, 'async'>
type EffectListT = EffectList<EffectV2<string, ['io', 'async']>>
type EffectSafeT = EffectSafe<PureV2<string>>
type HandledT = HandleV2<EffectV2<string, ['io', 'async']>, 'io'>
type HandleAllT = HandleAllV2<EffectV2<string, ['io']>>
type EffectTypeT = EffectType
// v1.12.0 - 插件系统 v2
type PluginV2T = PluginV2<{ config: string }>
type PluginAPIV2T = PluginAPIV2<{ config: string }>
type PluginHookV2T = PluginHookV2<string>
type PluginRegistryV2T = PluginRegistryV2<{ config: string }>
type PluginConfigV2T = PluginConfigV2<{ port: number }>
type PluginMetadataV2T = PluginMetadataV2
type RegisteredPluginT = RegisteredPlugin<{ config: string }>
// v1.12.0 - 互操作增强
type InteropT = Interop<{ name: string }, 'zod'>
type ConvertToZod = ConvertTo<{ name: string }, 'zod'>
type ConvertFromZod = ConvertFrom<{ type: 'object' }, 'zod'>
type ToZodT = ToZodSchema<{ name: string; age: number }>
type FromZodT = FromZodSchema<{ type: 'object'; shape: unknown }>
type ToYupT = ToYupSchema<{ name: string }>
type ToJSONSchemaT = ToJSONSchema<{ name: string; age: number }>
type BiDirT = BiDirectional<{ name: string }, { name: string }>
type ToReactT = ToReact<{ value: string }>
type ToVueT = ToVue<{ value: string }>
type InteropResultT = InteropResult<{ name: string }, 'zod', 'yup'>
// v1.12.0 - 开发者工具
type IDEIntT = IDEIntegration<{ name: string }>
type LangServerT = LanguageServer<{ name: string }>
type CodeActionT = CodeAction<{ name: string }>
type CodeLensT = CodeLens<{ name: string }>
type CompletionItemT = CompletionItem<{ name: string }>
type SmartCompletionT = SmartCompletion<{ name: string }>
type RefactorActionT = RefactorAction<{ name: string }>
type SafeRefactorT = SafeRefactor<{ name: string }>
type RefactorPreviewT = RefactorPreview<{ name: string }>
type SnippetTemplateT = SnippetTemplate<{ name: string }>
// v1.12.0 - 文档生成 v2
type TypeDocV2T = TypeDocumentation<{ name: string }>
type AutoDocT = AutoDoc<{ name: string }>
type DocTemplateV2T = DocTemplate<{ name: string }>
type GenerateJSDocT = GenerateJSDoc<{ name: string }>
type APIDocV2T = APIDocumentation<{ name: string }>
type EndpointDocT = EndpointDoc<{ name: string }>
type DocRenderOptionsT = DocRenderOptions
// v1.12.0 - 社区反馈
type FeatureFeedbackT = FeatureFeedback<{ userId: string }>
type BugReportT = BugReport<{ userId: string }>
type FeatureRequestT = FeatureRequest<{ userId: string }>
type UserSuggestionT = UserSuggestion<{ userId: string }>
type SurveyT = Survey<{ userId: string }>
type SurveyResultT = SurveyResult<{ userId: string }>
type FeedbackAnalysisT = FeedbackAnalysis<{ userId: string }>
type IssueTemplateT = IssueTemplate<{ name: string }>
// v1.12.0 - RC 质量门控
type QualityGateT = QualityGate<{ coverage: number }>
type GateConditionT = GateCondition<number>
type ValidateRCT = ValidateRC<{ coverage: number }>
type RCValidationReportT = RCValidationReport<{ coverage: number }>
type RCReadinessT = RCReadiness
type ReleaseCriteriaT = ReleaseCriteria<number>
type ReleaseBlockerT = ReleaseBlocker
type RCConfigT = RCConfigv1.13.0 类型
typescript
// v1.13.0 - 迁移工具包
type MigrationToolkitT = MigrationToolkit<{ fromVersion: '1.12.0'; toVersion: '1.13.0' }>
type MigrationPlanT = MigrationPlan<{ version: '1.13.0'; steps: unknown[] }>
type MigrationStepT = MigrationStep<{ action: 'rename'; from: 'OldType'; to: 'NewType' }>
type MigrationReportT = MigrationReport<{ fromVersion: '1.12.0'; toVersion: '1.13.0' }>
type CodemodConfigT = CodemodConfig<{ name: 'rename-legacy-types'; transform: 'jscodeshift' }>
type MigrationValidatorT = MigrationValidator<{ expectedTypes: unknown }>
type RollbackPlanT = RollbackPlan<{ version: '1.13.0'; rollbackTo: '1.12.0' }>
// v1.13.0 - v2.0.0 测试版功能
type V2BetaFeatureT = V2BetaFeature<{ name: 'AdvancedInference'; stability: 'beta' }>
type BetaAPIT = BetaAPI<{ experimental: true }, { newMethod: () => void }>
type PreviewTypeT = PreviewType<{ name: 'SmartInference'; behavior: 'enhanced' }>
type BetaConfigT = BetaConfig<{ enabledFeatures: string[] }>
type MigrationPreviewT = MigrationPreview<{ currentType: unknown; v2Type: unknown }>
type BetaFeedbackT = BetaFeedback<{ feature: 'AdvancedInference' }>
type V2CompatibilityLayerT = V2CompatibilityLayer<{ v1Types: unknown; v2Types: unknown }>
// v1.13.0 - 最终破坏性变更
type BreakingChangeT = BreakingChange<{ type: 'api-removal'; severity: 'major' }>
type BreakingChangeRegistryT = BreakingChangeRegistry<{ version: '1.13.0' }>
type DeprecationNoticeT = DeprecationNotice<{ type: 'LegacyFormatter'; removedIn: '2.0.0' }>
type ImpactAssessmentT = ImpactAssessment<{ codebase: 'my-project'; riskLevel: 'medium' }>
type ChangeCategoryT = ChangeCategory<'api-removal'>
type BreakingChangeGuardT2 = BreakingChangeGuard<{ blockedTypes: string[] }>
type MigrationAutomatorT = MigrationAutomator<{ version: '1.13.0'; coverage: 85 }>
// v1.13.0 - 双模式支持
type DualModeT = DualMode<{ strict: unknown; lenient: unknown }>
type ModeConfigT = ModeConfig<{ active: 'strict'; available: string[] }>
type StrictModeT = StrictMode<{ allowAny: false; strictNullChecks: true }>
type LenientModeT = LenientMode<{ allowAny: true; strictNullChecks: false }>
type ModeTransitionT = ModeTransition<{ from: 'lenient'; to: 'strict' }>
type ModeDetectorT = ModeDetector<{ detected: 'strict'; confidence: 'high' }>
type ModeCompatibilityT = ModeCompatibility<{ strictType: unknown; lenientType: unknown }>
// v1.13.0 - 最终性能优化
type FinalOptimizedT = FinalOptimized<{ original: unknown; depth: 5 }>
type CompilationProfileT = CompilationProfile<{ typeName: 'DeepPartial'; complexity: 'medium' }>
type PerformanceBudgetT = PerformanceBudget<{ maxInstantiationDepth: 50 }>
type LazyInferenceT = LazyInference<{ type: unknown; trigger: 'access' }>
type BatchEvaluationT = BatchEvaluation<{ types: string[]; parallelEvaluation: true }>
type MemoryOptimizedT = MemoryOptimized<{ original: unknown; memoryReduction: 40 }>
type CacheStrategyT = CacheStrategy<{ enabled: true; evictionPolicy: 'lru' }>
type PerformanceReportT = PerformanceReport<{ version: '1.13.0'; score: 95 }>
// v1.13.0 - 社区与生态
type CommunityPluginT = CommunityPlugin<{ name: 'uni-types-validators'; verified: true }>
type PluginRegistryT = PluginRegistry<{ totalPlugins: 50 }>
type ContributionGuideT = ContributionGuide<{ requiredTests: true }>
type EcosystemIntegrationT = EcosystemIntegration<{ framework: 'react' }>
type CommunityFeedbackT = CommunityFeedback<{ type: 'feature-request'; priority: 'high' }>
type PluginAPIT = PluginAPI<{ hooks: string[]; sandboxed: true }>
type GovernanceModelT = GovernanceModel<{ maintainers: 5 }>
type ReleaseCoordinationT = ReleaseCoordination<{ version: '1.13.0' }>
// v1.13.0 - 最终文档
type FinalDocConfigT = FinalDocConfig<{ version: '1.13.0'; format: 'markdown' }>
type TypeDocumentationT = TypeDocumentation<{ name: 'DeepPartial'; category: 'Deep Operations' }>
type VersionedDocT = VersionedDoc<{ type: 'DeepPartial'; currentVersion: '1.13.0' }>
type DocIndexT = DocIndex<{ totalTypes: 2500; searchable: true }>
type DocValidationT = DocValidation<{ coverage: 100; score: 95 }>
type DocTemplateT = DocTemplate<{ sections: string[]; localization: true }>
type APIReferenceT = APIReference<{ version: '1.13.0'; totalTypes: 2500 }>
// v1.13.0 - 最终稳定性与打磨
type StabilityReportT = StabilityReport<{ version: '1.13.0'; overallStability: 'production-ready' }>
type StabilityLevelT = StabilityLevel<'stable'>
type PolishResultT = PolishResult<{ improvements: 3; backwardsCompatible: true }>
type RegressionTestT = RegressionTest<{ name: 'DeepPartial-nested-arrays'; status: 'passing' }>
type EdgeCaseT = EdgeCase<{ name: 'DeepPartial-with-never'; handled: true }>
type TypeAuditT = TypeAudit<{ version: '1.13.0'; consistencyScore: 98 }>
type ProductionReadinessT = ProductionReadiness<{ version: '1.13.0'; overallStatus: 'ready' }>
type QualityScoreT = QualityScore<{ typeSafety: 99; overall: 97 }>
// v1.13.0 - 生命周期终止规划
type EOLTimelineT = EOLTimeline<{ feature: 'LegacyFormatter'; currentStatus: 'deprecated' }>
type EOLPolicyT = EOLPolicy<{ gracePeriod: '6-months'; migrationSupport: true }>
type DeprecationScheduleT = DeprecationSchedule<{ version: '1.13.0' }>
type MigrationDeadlineT = MigrationDeadline<{ feature: 'LegacyFormatter'; automated: true }>
type EOLNotificationT = EOLNotification<{ type: 'deprecation'; severity: 'warning' }>
type LifecycleStateT = LifecycleState<'deprecated'>
type SunsetPlanT = SunsetPlan<{ feature: 'LegacyFormatter' }>
type LegacySupportT = LegacySupport<{ feature: 'LegacyFormatter'; supported: true }>
// v1.13.0 - v2.0.0 发布准备
type LaunchChecklistT = LaunchChecklist<{ version: '2.0.0'; completion: 80 }>
type ReleasePlanT = ReleasePlan<{ version: '2.0.0'; phase: 'pre-release' }>
type RolloutStrategyT = RolloutStrategy<{ approach: 'gradual' }>
type ReleaseNotesT = ReleaseNotes<{ version: '2.0.0'; breakingChanges: 5 }>
type LaunchCoordinationT = LaunchCoordination<{ version: '2.0.0'; timing: 'synchronized' }>
type CompatibilityMatrixT = CompatibilityMatrix<{ version: '2.0.0' }>
type PostLaunchMonitorT = PostLaunchMonitor<{ version: '2.0.0'; monitoring: true }>
type LaunchReadinessT = LaunchReadiness<{ version: '2.0.0'; overall: 'ready' }>外部资源
- TypeScript Playground - TypeScript 官方演练场
- Type Challenges - TypeScript 类型挑战练习
- type-fest - 流行的 TypeScript 类型集合