haejunejung/ts-typekit

Support for `WithPrefix`

Closed this issue · 0 comments

It supports for `WithPrefix'.

The purpose of this type is to add a prefix to a string. For example as below.

type FormEventNames = "submit" | "reset" | "change";
type CaptializedFormEventNames = Capitalize<FormEventNames>; // 'Submit' | 'Reset' | 'Change'
type FormHandlerNames = WithPrefix<CaptializedFormEventNames, "on"> // "onSubmit" | "onReset" | "onChange";

It can be especially useful when deciding on a name.

  1. event handler.
  2. api endpoint.
  3. css class.
  4. state management action handlers.
  5. icon system.