Question: I have array:

`const someArray = ['one', 'two', 'three'];`

and I have type:

`type SomeType = 'one' | 'two' | 'three';`

How can I get `SomeType` from `someArray`?

Answer: 
You can, at the cost that you have to apply `as const` assertion to `someArray`.

```
const someArray = ['one', 'two', 'three'] as const;
                                       /* ^------- IMPORTANT!
                                          otherwise it'll just be `string[]` */

type GetItem<T> = T extends ReadonlyArray<infer I> ? I : never;

type SomeType = GetItem<typeof someArray>;  // 'one' | 'two' | 'three'

```
You can not, because TypeScript is not a dependently-typed language.

TypeScript, like almost any other well known statically typed language in existence at the moment, can create types for values, but not create types from values.

So you can create a type for your values:

`const someArray: SomeType[] = ['one', 'two', 'three'];`

but you can not create a type from your values:

`type SomeType = infer T for someArray[T] // invented syntax`

Only [dependently typed languages](https://en.wikipedia.org/wiki/Dependent_type) can do this. Unfortunately this is not yet mainstream. Give it another decade though and you'll be hearing more about this. 

Probably this does not mean you are stuck though. Over time I've had very few times where I could absolutely not get to the type just because the language was not dependently typed. You should try to ask another question and might get a satisfactory answer. There are ways for example to have types available during runtime, like with <https://github.com/gcanti/io-ts>.