@@ -61,7 +61,7 @@ export type TypedArray<T extends ArrayBufferLike = ArrayBuffer> =
6161 | BigUint64Array < T > ;
6262
6363export type ValueOf < T > = T [ keyof T ] ;
64- export type InstanceOf < T > = T extends new ( ...args : Array < unknown > ) => infer R ? R : never ;
64+ export type InstanceOf < T > = T extends new ( ...args : Array < never > ) => infer R ? R : never ;
6565export type KindOf < T > = InstanceOf < ValueOf < T > > ;
6666export type Extends < TObject , TExtends > = {
6767 [ TKey in keyof TObject ] : TObject [ TKey ] extends TExtends ? TObject [ TKey ] : undefined ;
@@ -72,32 +72,35 @@ export type TupleOf<T, N extends number, R extends Array<T> = []> = R['length']
7272 : TupleOf < T , N , [ T , ...R ] > ;
7373export type NumberTuple < T extends number > = TupleOf < number , T > ;
7474
75- export type BoxFourCC = keyof BoxRegistry [ 'box' ] ;
76- export type SampleEntryFourCC = keyof BoxRegistry [ 'sampleEntry' ] ;
77- export type SampleGroupEntryGroupingType = keyof BoxRegistry [ 'sampleGroupEntry' ] ;
78- export type UUIDKeys = keyof BoxRegistry [ 'uuid' ] ;
75+ type ConcreteBoxRegistry = BoxRegistry < typeof BOXES > ;
76+ export type BoxFourCC = keyof ConcreteBoxRegistry [ 'box' ] ;
77+ export type SampleEntryFourCC = keyof ConcreteBoxRegistry [ 'sampleEntry' ] ;
78+ export type SampleGroupEntryGroupingType = keyof ConcreteBoxRegistry [ 'sampleGroupEntry' ] ;
79+ export type UUIDKeys = keyof ConcreteBoxRegistry [ 'uuid' ] ;
7980export type AllIdentifiers =
8081 | BoxFourCC
8182 | SampleEntryFourCC
8283 | SampleGroupEntryGroupingType
8384 | UUIDKeys ;
8485
85- export type UUIDKind = InstanceOf < Extends < BoxRegistry [ 'uuid' ] , typeof Box > > ;
86- export type BoxKind = InstanceOf < Extends < BoxRegistry [ 'box' ] , typeof Box > > ;
87- export type SampleEntryKind = InstanceOf < Extends < BoxRegistry [ 'sampleEntry' ] , typeof SampleEntry > > ;
86+ export type UUIDKind = InstanceOf < Extends < ConcreteBoxRegistry [ 'uuid' ] , typeof Box > > ;
87+ export type BoxKind = InstanceOf < Extends < ConcreteBoxRegistry [ 'box' ] , typeof Box > > ;
88+ export type SampleEntryKind = InstanceOf <
89+ Extends < ConcreteBoxRegistry [ 'sampleEntry' ] , typeof SampleEntry >
90+ > ;
8891export type SampleGroupEntryKind = InstanceOf <
89- Extends < BoxRegistry [ 'sampleGroupEntry' ] , typeof SampleGroupEntry >
92+ Extends < ConcreteBoxRegistry [ 'sampleGroupEntry' ] , typeof SampleGroupEntry >
9093> ;
9194
9295export type AllRegisteredBoxes = {
93- [ K in AllIdentifiers ] : K extends keyof BoxRegistry [ 'box' ]
94- ? InstanceOf < BoxRegistry [ 'box' ] [ K ] >
95- : K extends keyof BoxRegistry [ 'sampleEntry' ]
96- ? InstanceOf < BoxRegistry [ 'sampleEntry' ] [ K ] >
97- : K extends keyof BoxRegistry [ 'sampleGroupEntry' ]
98- ? InstanceOf < BoxRegistry [ 'sampleGroupEntry' ] [ K ] >
99- : K extends keyof BoxRegistry [ 'uuid' ]
100- ? InstanceOf < BoxRegistry [ 'uuid' ] [ K ] >
96+ [ K in AllIdentifiers ] : K extends keyof ConcreteBoxRegistry [ 'box' ]
97+ ? InstanceOf < ConcreteBoxRegistry [ 'box' ] [ K ] >
98+ : K extends keyof ConcreteBoxRegistry [ 'sampleEntry' ]
99+ ? InstanceOf < ConcreteBoxRegistry [ 'sampleEntry' ] [ K ] >
100+ : K extends keyof ConcreteBoxRegistry [ 'sampleGroupEntry' ]
101+ ? InstanceOf < ConcreteBoxRegistry [ 'sampleGroupEntry' ] [ K ] >
102+ : K extends keyof ConcreteBoxRegistry [ 'uuid' ]
103+ ? InstanceOf < ConcreteBoxRegistry [ 'uuid' ] [ K ] >
101104 : never ;
102105} ;
103106
0 commit comments