Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Forbidden constructor, use a literal or simple function call instead error by gulp tslint? [duplicate]

I am working on angular 2 application using ag-grid plugin and gulp as build tool -

   #225 function onPageSizeChanged(pageSize) {
   #226     this.pageSize = new Number(pageSize);
        createNewDatasource();
    }

I am getting below error message for above code -

[gulp-tslint] error app/app.component.ts[226, 21]: Forbidden constructor, use a literal or simple function call instead

Please let me know if this information is not sufficient, I will provide further details. Thanks in advance.

like image 949
Akash Avatar asked Jan 28 '26 15:01

Akash


1 Answers

Just

this.pageSize = pageSize;

What's the intention of using new Number(pageSize); anyway?

See also https://github.com/palantir/tslint/blob/master/src/rules/noConstructRule.ts#L26

like image 174
Günter Zöchbauer Avatar answered Jan 31 '26 05:01

Günter Zöchbauer