Extracting Service Types from Layer Types in TypeScript

Is there an easy way to extract the type of the services provided by a Layer from the Layer type itself?
I have:
type LayerServices<T extends Layer.Layer<never, unknown, unknown>> =
  T extends Layer.Layer<infer S, unknown, unknown> ? S : never;


This really seems like a utility that would be provided, but I can't find it in the docs anywhere?
Was this page helpful?