Skip to content

Instantly share code, notes, and snippets.

@FlorianWendelborn
Created November 25, 2025 16:31
Show Gist options
  • Select an option

  • Save FlorianWendelborn/16fedcc1f5c84b4ad51875fccc8c7d78 to your computer and use it in GitHub Desktop.

Select an option

Save FlorianWendelborn/16fedcc1f5c84b4ad51875fccc8c7d78 to your computer and use it in GitHub Desktop.
/**
* Accepts any string, but provides autocomplete for special values.
*
* @example
* ```ts
* type Fruit = LooseAutocompletedString<'apple' | 'strawberry'>
* // autocompletes for `apple` and `strawberry` but also accepts `string`
* ```
*/
export type LooseAutocompletedString<T extends string> = T | Omit<string, T>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment