Skip to content

Decorated method can't resolve design:paramtypes #17080

Closed
@monkeycatdog

Description

@monkeycatdog

🐞 bug report

Affected Package

    "@angular/animations": "^9.0.0",
    "@angular/cdk": "^9.0.0",
    "@angular/common": "^9.0.0",
    "@angular/compiler": "^9.0.0",
    "@angular/core": "^9.0.0",
    "@angular/forms": "^9.0.0",
    "@angular/material": "^9.0.0",
    "@angular/material-moment-adapter": "^9.0.0",
    "@angular/platform-browser": "^9.0.0",
    "@angular/platform-browser-dynamic": "^9.0.0",
    "@angular/router": "^9.0.0",
    "@angular/service-worker": "^9.0.0"

Actually, I don't know about affected packages, maybe it's compiler ?

Is this a regression?

Yes, the previous version in which this bug was not present was: Angular 8

Description

So, I use a package decko, it's just decorators.
I bound my methods and they can't work now

🔬 Minimal Reproduction

class MyService {

@bind()
method(control: FormControl){}
}

🔥 Exception or Error


 Object(r.c)([Object(u.bind)(), Object(r.f)("design:type", Function), Object(r.f)("design:paramtypes", [FormControl]), Object(r.f)("design:returntype", Object)], t.prototype, "method", null)
   
main.d4d36d120046e5300844.js:formatted:609 Uncaught ReferenceError: FormControl is not defined
    at main.d4d36d120046e5300844.js:formatted:609
    at Object.0poW (main.d4d36d120046e5300844.js:formatted:615)
    at d (VM100 runtime.13bd04fd7c2374627883.js:1)
    at Object.gfmY (main.d4d36d120046e5300844.js:formatted:9885)
    at d (VM100 runtime.13bd04fd7c2374627883.js:1)
    at Object.7Y4b (main.d4d36d120046e5300844.js:formatted:1873)
    at d (VM100 runtime.13bd04fd7c2374627883.js:1)
    at Module.zUnb (main.d4d36d120046e5300844.js:formatted:13499)
    at d (VM100 runtime.13bd04fd7c2374627883.js:1)
    at Object.0 (main.d4d36d120046e5300844.js:formatted:263)

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.1
Node: 10.16.3
OS: darwin x64

Angular: 9.0.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router
... service-worker
Ivy Workspace: No

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.1
@angular-devkit/build-angular      0.900.1
@angular-devkit/build-ng-packagr   0.900.1
@angular-devkit/build-optimizer    0.900.1
@angular-devkit/build-webpack      0.900.1
@angular-devkit/core               9.0.1
@angular-devkit/schematics         9.0.1
@angular/cli                       9.0.1
@ngtools/webpack                   9.0.1
@schematics/angular                9.0.1
@schematics/update                 0.900.1
ng-packagr                         9.0.0
rxjs                               6.5.3
typescript                         3.7.5
webpack                            4.41.2

It resolved if i remove @bind() and use arrow function.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions