I am trying to create a custom dynamic type that represents a union of interface symbols from a file called "MyInterfaces.ts"
export interface SomeInterfaceA {}
export interface SomeInterfaceB {}
...
export interface SomeInterfaceZ {}
The definition I am using is as follows:
import * as AllMyInterfaces from "./MyInterfaces"
type InterfaceNames = keyof typeof AllMyInterfaces
const test: InterfaceNames = "SomeInterfaceA"
//^^^^^^^^^ TS2322: Type 'string' is not assignable to type 'never'.
However, I am getting an error from the compiler stating: Type 'string' is not assignable to type 'never'
It seems like the result of "typeof AllMyInterfaces" does not contain any interface symbol. How can I properly define my Union type in order to resolve this issue? Thank you for your help.