Dynamic return type of function based on input params (like TypeScript)W

Is it possible in Kotlin to define the return type based on the input params like in TypeScript?

My usecase (an example of GitHub actions kotlin DSL):

val secrets = uses(
  action =
  HashicorpVaultActionWithOutputs(
    vault = vault,
    secrets =
    listOf(
      HashicorpVaultActionWithOutputs.Secret("path/of/secret", "region", "DEFAULT_AWS_REGION"),
      HashicorpVaultActionWithOutputs.Secret("path/of/secret", "account", "AWS_ACCOUNT_ID"),
    )
  )
).outputs
uses(
  action = configureAwsCredentialsV2(
    awsAccountId = secrets.AWS_ACCOUNT_ID,
    awsRegion = secrets.DEFAULT_AWS_REGION
  )
)

Explanation

uses returns the outputs property of the HashicorpVaultActionWithOutputs object.

What should happen

The IDE should know that the outputs object contains the keys AWS_ACCOUNT_ID and DEFAULT_AWS_REGION

Typescript example: const modifiers make generics a LOT easier - YouTube