Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed generation when using @Res() decorator in controllers #10

Open
netandreus opened this issue Dec 7, 2022 · 1 comment
Open

Failed generation when using @Res() decorator in controllers #10

netandreus opened this issue Dec 7, 2022 · 1 comment
Labels
enhancement New feature or request planned

Comments

@netandreus
Copy link

netandreus commented Dec 7, 2022

Use case

In my application.controller.ts there is such action:

import { Response } from "express";
...
async index(@Res() res: Response) {
...
}

When I run generate command ./node_modules/.bin/nest-sdk-generator ./frontend/sdk-generator.json I get this error:

-> Extracting type Response from file ../node_modules/@types/express/index.d.ts...
ERROR: Type Response was not found in file ../node_modules/@types/express/index.d.ts

When we open @type/express L127 we can see that there is a namespace.

Config

sdk-generator.json

{
    "verbose": true,
    "apiInputPath": "../backend",
    "sdkOutput": "src/sdk",
    "sdkInterfacePath": "src/sdk/sdk-interface.ts"
}

Cause

I think that is because of one of limitation of nest-sdk-generator:

Types belonging to namespaces are currently not supported and will result in error in the generated code
@clement-estone clement-estone added the enhancement New feature or request label Dec 9, 2022
@clement-estone
Copy link
Collaborator

Seems like this is the problem, indeed. I'll try to take some time and find a way to extract types from namespaces but unfortunately it's really hard to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

2 participants