question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS generates "use strict" in front of everything, this makes impossible to use its output for Task Runner Explorer without touching the output manually (or by script)

See original GitHub issue

TypeScript Version: 2.2.1 - 2.9.1

TS generates the “use strict” before starting notes in the js file. These notes can include directions for post-processing tools, or another tools like Task Runner Explorer in Visual Studio which looks for the binding information on the first line of the gulpfile.js or gruntfile.js. It is necessary to write a post-build task to fix this and makes it impossible to include the binding information directly to ts file if gulpfile or gruntfile is written in typescript.

Code

/// <binding Clean='clean' ProjectOpened='projectOpen' />
/* some notes */
function test(): void {
}

Expected behavior:

/// <binding Clean='clean' ProjectOpened='projectOpen' />
/* some notes */
"use strict";
function test() {
}

Actual behavior:

"use strict";
/// <binding Clean='clean' ProjectOpened='projectOpen' />
/* some notes */
function test() {
}

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
wilsonianbcommented, Sep 20, 2019

I’m currently encountering this while trying to use @jest-environment docblock at the top of files with TypeScript version 3.6.3

2reactions
fis-czcommented, Jun 4, 2019

@pchodak Yes. I did. As well as many other problems with typescript which are not fixed or not wanted to be implemented. I moved to “es next” and I am using babel to transpile to ES5 if I need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Use Strict" needed in a TypeScript file? - Stack Overflow
Your points for using ECMAScript strict mode are valid, but as pointed out in the accepted answer, it is better to achieve this...
Read more >
Tasks in Visual Studio Code
Integrate with External Tools via Tasks. Lots of tools exist to automate tasks like linting, building, packaging, testing, or deploying software systems.
Read more >
CREAK Data Explorer - UT Computer Science
Due to its high density, countries around the world use Palladium to mint coins. ... An Essay obscures information and makes it hard...
Read more >
The 10 Most Common JavaScript Issues Developers Face
Prevents accidental globals. Without strict mode, assigning a value to an undeclared variable automatically creates a global variable with that name. This is ......
Read more >
Handling common JavaScript problems - MDN Web Docs
When developers make use of new/nascent JavaScript features, ... you to enter your JavaScript code on the left and provides an output on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found