What should the type of each `config` module be in my project?

System Information
  • Strapi Version: 4.10.2
  • Node Version: 18.15.0
  • PNPM Version: 8.1.0

I’m trying to type config modules that locate in config/ directory(or at least arguments passed to the config functions, especially env field for the first argument), but I can’t find any reference for this.

Does Strapi have a type definition for any config or at least for arguments passed to a config function? If it does, where is the type?

Thanks in advance, and sorry for any mistake in advance, it’s the first time for me being here.

I dug into it and I found there is no typing for this.
For those who looking for the type of env field, use this:

type GetStrapiEnvFunction<T> = <
  D extends T | never = never,
>(
  key: string,
  defaultValue?: D,
) => typeof defaultValue extends undefined
  ? T | undefined
  : T;

type GetStrapiEnv =
& GetStrapiEnvFunction<string>
& {
  int: GetStrapiEnvFunction<number>;
  float: GetStrapiEnvFunction<number>;
  bool: GetStrapiEnvFunction<boolean>;
  json: GetStrapiEnvFunction<unknown>;
  array: GetStrapiEnvFunction<unknown[]>;
};

interface GetStrapiConfig {
  env: GetStrapiEnv;
}