Skip to content

Instantly share code, notes, and snippets.

/**
* get all keys from T of type `string` (exclude `number` and `symbol`)
*/
export type ObjectKeys<T> = Extract<keyof T, string>
export type ObjectValues<T> = T[ObjectKeys<T>]
/**
* Object.keys(), but assert that an array of T's keys is returned, not `string[]`
*/
export const objectKeys = <T>(obj: T) => Object.keys(obj) as ObjectKeys<T>[]
@evilmarty
evilmarty / README.md
Last active December 14, 2015 13:39
Ember-backed autocomplete

In my journey in figuring out the Ember pattern, this is my attempt at trying to create an Ember-only autocomplete field. There were a few outcomes I wanted out of this, a part from being the Ember-way:

  • Work with any data source
  • Easily templatable results
  • Use only Ember constructs

All are welcome to use this, I'm just after feedback at this point.