Skip to content

Instantly share code, notes, and snippets.

View bengry's full-sized avatar

Ben Grynhaus bengry

  • wiz-sec
  • Israel
  • 07:37 (UTC +03:00)
View GitHub Profile
@bengry
bengry / StringWithAutocomplete.ts
Created August 31, 2024 20:35
Utility function for class organization when using libraries like Tailwind, which get very verbose very fast
/**
* A utility type around `string` that allows for autocomplete on the string on a specific set of values, yet accepting any string.
*
* @see https://twitter.com/diegohaz/status/1524257274012876801
*/
export type StringWithAutocomplete<S extends string> =
| S
| (string & Record<never, never>);