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 issueTypeScript 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:
- Created 6 years ago
- Reactions:5
- Comments:10 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m currently encountering this while trying to use @jest-environment docblock at the top of files with TypeScript version 3.6.3
@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.