-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
TypeError: Cannot call a class as a function #6586
Comments
Please provide a minimum reproduction |
This is worth reading regarding this issue. Basically it's only checking if it's a native class. It's not checking if it's a conventional class. https://stackoverflow.com/a/49510834 Here is an example of a regex that checks for a conventional class. If we're worried that checking for a conventional class will trigger a false positive, we could also use duck typing to check if the https://github.com/bevry/typechecker/blob/master/source/index.ts#L5 |
docker run --rm -p 27017:27017 mongo npm install -g pnpm
git clone https://github.com/clayrisser/example-graphback-nestjs
cd example-graphback-nestjs
make start curl localhost:3000 |
I created a pull request to fix this. #6587 |
Let's track this herehttps://github.com//pull/6587 |
…leware-class fix(core): detect conventional middleware class #6586
Bug Report
NestJS does not correctly detect class when babel transforms class to function.
Current behavior
throws following error
Input Code
.baberc
Expected behavior
Should log
some middleware
when api is called.Possible Solution
Update
isClass
implementation to detect a class that was transformed to a function.nest/packages/core/middleware/utils.ts
Line 62 in d6bc71d
Environment
The text was updated successfully, but these errors were encountered: