Skip to content

GenerateMetadataError: Unknown type: IndexedAccessType #1622

@douglasg14b

Description

@douglasg14b

Sorting

  • I'm submitting a ...

    • bug report
    • feature request
    • support request
  • I confirm that I

    • used the search to make sure that a similar issue hasn't already been submit

I found several referneced, but they all appeard to be fixed...?

Expected Behavior

When I tun tsoa routes the following controller fails:

export type BaseIVR3Config = {
    walkingSkeletonPath: WalkingSkeletonPath;
    bestMovies: BestMovies;
};

export type BaseIVR3ConfigKey = keyof BaseIVR3Config;
export type BaseIVR3ConfigValue = BaseIVR3Config[BaseIVR3ConfigKey]; // WalkingSkeletonPath | BestMovies

type WalkingSkeletonPath = 'A' | 'B';
type BestMovies = {
    title: string;
    year: number;
}[];

@Route('config2')
export class Config2Controller extends Controller {
    constructor(private useCases: ConfigUseCases) {
        super();
    }

    @Get('{key}')
    async getByKey(@Path() key: BaseIVR3ConfigKey): Promise<BaseIVR3ConfigValue | 'error'> {
        const result = await this.useCases.getByKey(key);

        if (result.ok) {
            return result.value.value;
        }

        return 'error';
    }
}

Current Behavior

This fails with:

Generate routes error.
GenerateMetadataError: Unknown type: IndexedAccessType
This was caused by 'BaseIVR3Config[BaseIVR3ConfigKey] | 'error''

Possible Solution

Unknown

Steps to Reproduce

Use the above code with tsoa

Context (Environment)

Version of the library: 6.2.1
Version of NodeJS: 18.13.0

  • Confirm you were using yarn not npm: [ ]
    • We are using pnpm

Detailed Description

N/A See above

Breaking change?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions