type alias AutoComplete

This is a utility type that allows you to Autocomplete a string.

For example, let's say you have a situation where you would like an input autocompleted with suggestion, but you also want people to be able to type whatever they want. This would come in handy.

Examples

Example 1

function setUserRole(role: AutoComplete<'free' | 'paid' | 'admin'>): void { // omitted }

Type Parameters

T extends string

Definition

T | (string & Record<PropertyKey, unknown>)

Usage

import { type AutoComplete } from ".";