In my TypeScript library, I have a class that compiles to JavaScript:
ClassName = ClassName_1 = class ClassName{
...
}
ClassName = ClassName_1 = decorate([
...])
However, when I compile it with an Angular frontend that relies on this library using the following command:
./node_modules/.bin/ng build --configuration=development --base-href /client/ --deploy-url /client/
An error is thrown:
ERROR in ./node_modules/library/ClassName.js
Module build failed: Error: Debug Failure. False expression.
I am using TypeScript version 2.9.2
for an Angular 6 project. Even after trying version 7.0.0-rc
with `3.0.3, the error persists.
Manually modifying the .js file bypasses the error:
ClassName = class ClassName{
...
}
ClassName_1 = ClassName
ClassName = ClassName_1 = decorate([
...])
ClassName_1 = ClassName
The problematic code causing the error is as follows:
/**
* Endpoint gives the baseDomain of MultiChat and gives the appropriate protocol.
* This is useful so you can pass through the same object to resources and streams types.
*
* A custom object is introduced to allow to pass the same object to use for WebSockets and https calls.
* Paths are also added to easily construct full routes.
*
* The design is to return full new objects so that you do not mix references.
*/
@injectable()
export class Endpoint {
public secure: boolean;
public baseDomain: string;
public paths: string[];
public port: number;
public queries: Map<string, string>;
/**
* init initializes the Endpoint with the correct baseDomain.
* @param secure is true if the _endpoint is reachable by HTTPS and WSS
* @param baseDomain the basedomain of the _endpoint, eg. independer.nl.
* @param paths additional paths to the _endpoint without slashes, eg. ["api"]
* @param port the port the _endpoint is hosted on
*/
constructor(secure: boolean, baseDomain: string, paths: string[] = [], port?: number) {
this.baseDomain = baseDomain;
this.paths = paths;
this.port = port;
this.secure = secure;
this.queries = new Map<string, string>();
}
// Other methods go here...
}