Closed
Description
Bug Report
🔎 Search Terms
Variants of this: [ts compile] generating js ([variable names] [declarations ])
🕗 Version & Regression Information
Introduce after version 4.2.4 by the looks of it, version 4.3.2 features the bug.
nt-bugs
This issue also exists in the latest Nightly build, sorry.
Please keep and fill in the line that best applies:
-->
- This changed between versions 4.2.4 and 4.3.2, there was no 4.3.1 to install.
1-Input
import * as axios from 'axios'; //"version": "0.18.0"
export class IResponseError extends Error {
constructor(message:string, public axiosResponse:axios.AxiosResponse<any>) {
super(message);
}
}
1-Output
class IResponseError extends Error {
axiosResponse; //** random line of generated code, which stops imports into react and things, it shouldn't be here
constructor(message, axiosResponse) {
super(message);
2-Input
export class GatewayConfigAPI {
constructor(private endpoint: string) {
this.endpoint = endpoint.substring(0, endpoint.length - 1);
}
}
2-Output
Module parse failed: Unexpected token (54:12)
You may need an appropriate loader to handle this file type.
| })(IGatewayConfigController = exports.IGatewayConfigController || (exports.IGatewayConfigController = {}));
| class GatewayConfigAPI {
| endpoint; // ***************Line 54 this line should not have been generated.
| constructor(endpoint) {
| this.endpoint = endpoint;// unessary line
this.endpoint = endpoint.substring(0, endpoint.length - 1);
}
3 - Input:
import {IsString, IsBoolean, ValidateNested} from 'class-validator'
export class IDONetMapsEDIConfigShare {
@IsString()
nethost: string;
@IsString()
netshare: string;
@IsString()
username: string;
@IsString()
password: string;
}
3- Output:
class IDONetMapsEDIConfigShare {
nethost; // This shouldn't be here
netshare; // This shouldn't be here
username; // This shouldn't be here
password; // This shouldn't be here
}
4-Input
export class IDONetMapsEDIConfigResponse {
constructor(clone: INetMapsEDIServicesConfigComplete, activeStatus: string) {
this.enabled = clone.enabled;
this.netMapsEDI = clone.netMapsEDI !== undefined ? clone.netMapsEDI : null;
this.activeStatus = activeStatus;
// look at just writting a generic class that does this, where we pick using and clone, extends, use type hack I know later.
}
@IsBoolean()
enabled:boolean;
@IsString()
activeStatus:string;
@ValidateNested()
//@Type(() => IDONetMapsEDIConfigShare)
netMapsEDI: IDONetMapsEDIConfigShare | null;
}
4 - Output JS
class IDONetMapsEDIConfigResponse {
constructor(clone, activeStatus) {
this.enabled = clone.enabled;
this.netMapsEDI = clone.netMapsEDI !== undefined ? clone.netMapsEDI : null;
this.activeStatus = activeStatus;
// look at just writting a generic class that does this, where we pick using and clone, extends, use type hack I know later.
}
enabled;// This should not be here.
activeStatus;
//@Type(() => IDONetMapsEDIConfigShare)
netMapsEDI;
}
4 - Expected JS
class IDONetMapsEDIConfigResponse {
constructor(clone, activeStatus) {
this.enabled = clone.enabled;
this.netMapsEDI = clone.netMapsEDI !== undefined ? clone.netMapsEDI : null;
this.activeStatus = activeStatus;
// look at just writting a generic class that does this, where we pick using and clone, extends, use type hack I know later.
}
activeStatus;
//@Type(() => IDONetMapsEDIConfigShare)
netMapsEDI;
}
Kind Regards,
Wesley Oliver