ivogabe / gulp-typescript

A TypeScript compiler for gulp with incremental compilation support.
MIT License
822 stars 129 forks source link

Unable to OR'd the variables using the symple '||=' in gulp-typescript@6.0.0-alpha.1 #672

Closed Terry-Fedirko closed 2 years ago

Terry-Fedirko commented 2 years ago

I have a TypeScript code that contains the following lines:

var modifyFlag = false; for (var phase of phases) { modifyFlag ||= UpdateVerticalPhaseTitleWidth(phase, args.propertyName); }

When I compile this cold using TS_Build task in Visual Studio 2022 Task Runner Explorer, I get the following error message:

file: dev\typescript-diagram\Shapes\DiagramShapeFactory.ts: [909] diagram.updateNode(sourceShape.name, [11:51:56] 'TS_Build' errored after 3.74 s [11:51:56] GulpUglifyError: unable to minify JavaScript Caused by: SyntaxError: Unexpected token: punc (;) File: C:\Projects1\Repos\NavviaProjects\Navvia\dist\js\NavviaDiagram.js Line: 982 Process terminated with code 1.

The error generated at Line 982 which is

'modifyFlag ||= UpdateVerticalPhaseTitleWidth(phase, args.propertyName);'.

In regular JavaScript, the '||=' this is valid (and I tested to make sure in JS Fiddle) but gulp-typescript@6.0.0-alpha.1 sees it as an error.

I do have a work around for this but it is not a good solution (gulp-typescript@6.0.0-alpha.1 is able to compile this my work around successfully).

Terry-Fedirko commented 2 years ago

In Fiddle JS, I did this but still get a syntax error but it does execute correctly:

image

But it would be better if I did this instead to remove that error:

image

Conclusion: I am closing this issue as it can be rewritten other ways instead of '||=' which the gulp-typescript@6.0.0-alpha.1 does not need require any fixing.

Terry-Fedirko commented 2 years ago

Closing this issue.