feat: Try two different kinds of type reflection (#5)
Co-authored-by: Jos de Jong <wjosdejong@gmail.com> Reviewed-on: #5 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
parent
239215c234
commit
59c325ff6c
7 changed files with 618 additions and 14 deletions
|
@ -102,6 +102,10 @@ type Implementations<
|
|||
Specs extends Specifications<Signatures, NeedKeys, NeedList>
|
||||
> = {[K in NeedKeys]: ImpType<Signatures, K, Specs[K]>}
|
||||
|
||||
export interface ReflectedTypeInfo {
|
||||
reflectedType5: string
|
||||
}
|
||||
|
||||
// The builder interface that lets us assemble narrowly-typed Implementations:
|
||||
interface ImplementationBuilder<
|
||||
Signatures extends GenSigs,
|
||||
|
@ -135,7 +139,7 @@ interface ImplementationBuilder<
|
|||
Specs & {[K in NewKeys]: DepCheck<RD, Signatures>}
|
||||
>
|
||||
|
||||
ship(): Implementations<Signatures, NeedKeys, NeedList, Specs>
|
||||
ship(info?: ReflectedTypeInfo): Implementations<Signatures, NeedKeys, NeedList, Specs> & ReflectedTypeInfo
|
||||
}
|
||||
|
||||
// And a function that actually provides the builder interface:
|
||||
|
@ -187,9 +191,8 @@ function impBuilder<
|
|||
Specs & {[K in NewKeys]: DepCheck<RD, Signatures, DepKeys>}
|
||||
>
|
||||
},
|
||||
ship() {
|
||||
return (sofar as
|
||||
Implementations<Signatures, NeedKeys, NeedList, Specs>)
|
||||
ship(info?: ReflectedTypeInfo) {
|
||||
return { ...sofar, ...info }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue