std
    Preparing search index...

    Type Alias LooseAutocomplete<T>

    LooseAutocomplete: T | string & {}

    Allows you to have autocomplete on a string while still accepting any string value.

    type Fruits = LooseAutocomplete<'apple' | 'orange' | 'pear'>;

    // you will still get autocomplete here
    let fruit: Fruits = 'apple'; // valid
    fruit = 'banana'; // valid

    Type Parameters

    • T