Fixed StaticMembers and subtraiting
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2023-12-29 23:47:24 +01:00
parent 85d97e0ec8
commit cabf2e0d74
2 changed files with 10 additions and 3 deletions

View File

@@ -5,7 +5,9 @@ import { AbstractClass, AbstractConstructor, Opaque, UnionToIntersection } from
* Represents the static members of a class. * Represents the static members of a class.
* @template C - The class type. * @template C - The class type.
*/ */
export type StaticMembers<C> = Pick<C, keyof C> export type StaticMembers<C> = {
[Key in keyof C as Key extends "prototype" ? never : Key]: C[Key]
}
/** /**

View File

@@ -1,4 +1,4 @@
import { expresses, trait } from "." import { expresses, extendsAndExpresses, trait } from "."
const Identifiable = <ID>() => const Identifiable = <ID>() =>
@@ -21,8 +21,13 @@ const Identifiable = <ID>() =>
const ImplementsIdentifiable = <ID>(defaultID: ID) => const ImplementsIdentifiable = <ID>(defaultID: ID) =>
trait(Parent => { trait(Parent => {
abstract class ImplementsIdentifiable extends Identifiable<ID>()(Parent) { abstract class ImplementsIdentifiable extends extendsAndExpresses(Parent, [Identifiable<ID>()]) {
id: ID = defaultID id: ID = defaultID
constructor(...args: any[]) {
super(...args)
console.log("ImplementsIdentifiable constructor")
}
} }
return ImplementsIdentifiable return ImplementsIdentifiable