Type Alias PropsOfKnownPrototype<Tinput, TkeysOptions>

PropsOfKnownPrototype<Tinput, TkeysOptions>: IsAnyOrUnknown<TkeysOptions> extends true
    ? PropsOfKnownPrototype<Tinput>
    : IsPropTrue<"nonEnumerables", TkeysOptions> extends true
        ? (IsPropTrue<"inherited", TkeysOptions> extends true
            ? (IsPropTrue<"string", TkeysOptions, true> extends true
                ? PropsOfKnownPrototype_stringNonEnumerablesInherited<Tinput> | ((...) extends (...)
                    ? (...)
                    : (...)) | ((...) extends (...)
                    ? (...)
                    : (...))
                : never) | (IsPropTrue<"symbol", TkeysOptions> extends true
                ? PropsOfKnownPrototype_symbolNonEnumerablesInherited<Tinput>
                : never)
            : never) | (IsPropTrue<"own", TkeysOptions, true> extends true
            ? (IsPropTrue<"string", TkeysOptions, true> extends true
                ? PropsOfKnownPrototype_stringNonEnumerablesOwn<Tinput>
                : never) | (IsPropTrue<"symbol", TkeysOptions> extends true
                ? PropsOfKnownPrototype_symbolNonEnumerablesOwn<Tinput>
                : never)
            : never)
        : never

Get the prototype chain's props of Tinput, according to the TkeysOptions passed, so we can exclude them from the instance props.

It uses fine-grained props type info, so it can return the right props according to the options: it filters according to string, symbol, nonEnumerables, inherited & own, respecting their defaults as described in KeysOptions docs.

For example, for Arrays, it ends up using:

  • Tarray_prototype_stringNonEnumerablesOwn
  • Tarray_prototype_stringNonEnumerablesInherited
  • Tarray_prototype_symbolNonEnumerablesInherited

by respectively calling into:

  • PropsOfKnownPrototype_stringNonEnumerablesInherited<>
  • PropsOfKnownPrototype_symbolNonEnumerablesInherited<>
  • PropsOfKnownPrototype_stringNonEnumerablesOwn<>

depending on the options passed.

If a prototype is not known at compile time (eg a custom user class), it returns never. Currently, as of TypeScript 5.4, there is no way to get the inherited prototype chain props of a class / instance at compile time

Type Parameters

@todo(888): add link to issue - keyofOwn missing in TS & Can't infer BaseClass from SubClass https://stackoverflow.com/questions/56377792/typescript-get-type-of-super-class

Finally, it returns Tobject_stringNonEnumerablesInheritedTop if top: true.