Skip to content

Commit b55be28

Browse files
committed
add defineSeriesInstrument function
1 parent 5ca6d83 commit b55be28

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

packages/runtime-core/src/define.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { ApprovedLicense } from '@opendatacapture/licenses';
55
import type { InstrumentKind, InstrumentLanguage, InstrumentValidationSchema } from './types/instrument.base.js';
66
import type { FormInstrument } from './types/instrument.form.js';
77
import type { InteractiveInstrument } from './types/instrument.interactive.js';
8+
import type { SeriesInstrument } from './types/instrument.series.js';
89

910
declare global {
1011
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-empty-object-type
@@ -60,3 +61,12 @@ export function defineInstrument<
6061
__runtimeVersion: 1
6162
}) as unknown as DiscriminatedInstrument<TKind, TLanguage, TSchema['_output']>;
6263
}
64+
65+
/** @public */
66+
export function defineSeriesInstrument<TLanguage extends InstrumentLanguage>(
67+
def: Omit<SeriesInstrument<TLanguage>, '__runtimeVersion'>
68+
): SeriesInstrument<TLanguage> {
69+
return Object.assign(def, {
70+
__runtimeVersion: 1 as const
71+
});
72+
}

packages/runtime-core/src/types/instrument.series.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Merge } from 'type-fest';
33
import type { Language } from './core.js';
44
import type { BaseInstrument, InstrumentLanguage, ScalarInstrumentInternal } from './instrument.base.js';
55

6-
/** @beta */
6+
/** @public */
77
declare type SeriesInstrument<TLanguage extends InstrumentLanguage = InstrumentLanguage> = Merge<
88
BaseInstrument<TLanguage>,
99
{

0 commit comments

Comments
 (0)