#Use namespace as type.

1 messages · Page 1 of 1 (latest)

frail lance
#

I know error says literally opposite, but i use some package where i really really need to get exported stuff from it in similar way as below as i would appreciate any type of help, isn't there some way to map it or something?

soft moonBOT
#
digital39999#0

Preview:```ts
namespace Test {
export type Wow1 = string
export type Wow2 = number
export type Wow3 = boolean
}

export type Numbers = "1" | "2" | "3"

export type Imagine = Test[Wow${Numbers}]```

gentle ruin
#

you'd need a type to do type transforms, so either a type or an interface
usually an interface for mapping

soft moonBOT
#
that_guy977#0

Preview:```ts
interface Test {
Wow1: string
Wow2: number
Wow3: boolean
}

export type Numbers = "1" | "2" | "3"

export type Imagine = Test[Wow${Numbers}]```

gentle ruin
#

if you need a namespace, you could have it separate from the interface

#

but you can't really access exported types dynamically i don't think

frail lance
#

aw that's sad

#

i wanted to avoid redundantion