Skip to content

Commit

Permalink
test(type): extract type annotation options
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-sa committed Feb 9, 2024
1 parent 19e973f commit 7508276
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/type/tests/integration4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
*/

import { expect, test } from '@jest/globals';
import { assertType, AutoIncrement, Group, groupAnnotation, PrimaryKey, ReflectionKind } from '../src/reflection/type.js';
import { assertType, AutoIncrement, ExtractTypeAnnotationOptions, Group, groupAnnotation, PrimaryKey, ReflectionKind, TypeAnnotation } from '../src/reflection/type.js';
import { typeOf } from '../src/reflection/reflection.js';
import { cast } from '../src/serializer-facade.js';
import { expectType } from './utils';

test('group from enum', () => {
enum Groups {
Expand Down Expand Up @@ -143,3 +144,13 @@ test('union loosely', () => {
expect(cast<a>({ id: 2 })).toEqual({ id: 2 });
expect(cast<a>({ id: '3' })).toEqual({ id: 3 });
});

test('extract type annotation options', () => {
type Skip = TypeAnnotation<'skip', { if: boolean }>;

type SkipOptions = ExtractTypeAnnotationOptions<Skip>;

const options: SkipOptions = {
if: true,
};
});

0 comments on commit 7508276

Please sign in to comment.