设计tracer
This commit is contained in:
22
src/tracers.ts/action-type.ts
Normal file
22
src/tracers.ts/action-type.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export const ARRAY_TRACER_ACTIONS = [
|
||||
'define',
|
||||
'preset',
|
||||
'expand',
|
||||
'reduce',
|
||||
'pick',
|
||||
'drop',
|
||||
'patch',
|
||||
'reset',
|
||||
] as const;
|
||||
|
||||
export type ArrayTracerAction = (typeof ARRAY_TRACER_ACTIONS)[number];
|
||||
|
||||
export const STACK_TRACER_ACTIONS = [
|
||||
//
|
||||
'define',
|
||||
'push',
|
||||
] as const;
|
||||
|
||||
export type StackTracerAction = (typeof STACK_TRACER_ACTIONS)[number];
|
||||
|
||||
export type TracerAction = ArrayTracerAction | StackTracerAction;
|
||||
@@ -13,9 +13,8 @@ type TracerTypeKey = keyof typeof TracerType;
|
||||
|
||||
type TracerTypeVal = (typeof TracerType)[TracerTypeKey];
|
||||
|
||||
const Action = {
|
||||
const ArrayTracerAction = {
|
||||
Define: 'define',
|
||||
|
||||
Preset: 'preset',
|
||||
Expand: 'expand',
|
||||
Reduce: 'reduce',
|
||||
@@ -25,6 +24,14 @@ const Action = {
|
||||
Reset: 'reset',
|
||||
} as const;
|
||||
|
||||
type ArrayTracerActionKey = keyof typeof ArrayTracerAction;
|
||||
|
||||
type ArrayTracerActionVal = (typeof ArrayTracerAction)[ArrayTracerActionKey];
|
||||
|
||||
const Action = {
|
||||
...ArrayTracerAction,
|
||||
} as const;
|
||||
|
||||
type ActionKey = keyof typeof Action;
|
||||
|
||||
type ActionVal = (typeof Action)[ActionKey];
|
||||
|
||||
12
src/tracers.ts/tracer-type.ts
Normal file
12
src/tracers.ts/tracer-type.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export const TRACER_TYPES = [
|
||||
'ArrayTracer',
|
||||
'StackTracer',
|
||||
'QueueTracer',
|
||||
'MatrixTracer',
|
||||
'SortTracer',
|
||||
'LinkTracer',
|
||||
'TreeTracer',
|
||||
'GraphTracer',
|
||||
] as const;
|
||||
|
||||
export type TracerType = typeof TRACER_TYPES[number];
|
||||
Reference in New Issue
Block a user