# enumValueFromString · FT4 TypeScript client · Chromia Docs (concept)

> enumValueFromString< T extends EnumLike >(str: string, enumType: T ): T [keyof T ] Creates an enum instance from a string value. Throws an error if the pro

Source: https://docs.chromia.com/pages/ft4-ts-client/functions/utils.enumValueFromString/

Function

# enumValueFromString

* ```signature
  enumValueFromString<T extends EnumLike>(str: string, enumType: T): T[keyof T]
  ```

  Creates an enum instance from a string value. Throws an error if the provided
  enum does not have a value that matches the string.

  #### Type Parameters

  + T extends [EnumLike](https://docs.chromia.com/pages/ft4-ts-client/types/utils.EnumLike/)

  #### Parameters

  + str: string

    the string value
  + enumType: [T](#enumvaluefromstringt)

    the enum type in which the string is a value

  #### Returns [T](#enumvaluefromstringt)[keyof [T](#enumvaluefromstringt)]

[View this page on docs.chromia.com](https://docs.chromia.com/pages/ft4-ts-client/functions/utils.enumValueFromString.html)Generated API reference, mirrored from the live docs
