File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,12 @@ import { PostTransformer } from './fixtures/transformers/post.ts'
1919import { UserTransformer } from './fixtures/transformers/user.ts'
2020import { EmailTransformer } from './fixtures/transformers/email.ts'
2121import { ProfileTransformer } from './fixtures/transformers/profile.ts'
22- import { type InferVariants , type InferData , type ResourceData } from '../src/types.ts'
22+ import {
23+ type InferVariants ,
24+ type InferData ,
25+ type ResourceData ,
26+ type ExtractTransformerVariants ,
27+ } from '../src/types.ts'
2328
2429declare module '../src/types.ts' {
2530 interface ExtendedJSONTypes {
@@ -435,6 +440,12 @@ test.group('Types | Fixtures', () => {
435440 expectTypeOf ( emailDataObject ) . toEqualTypeOf < EmailData > ( )
436441 } )
437442
443+ test ( 'make useVariant type-safe' , async ( { expectTypeOf } ) => {
444+ expectTypeOf < ExtractTransformerVariants < UserTransformer > > ( ) . toEqualTypeOf <
445+ 'basicInfo' | 'toObject'
446+ > ( )
447+ } )
448+
438449 test ( 'infer all variants of a transformer' , async ( { expectTypeOf } ) => {
439450 const user = new User ( )
440451 const userTransformer = new UserTransformer ( user )
You can’t perform that action at this time.
0 commit comments