-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: 3.0.0-dev.20180605
Search Terms:
Code
// this is obviously a bogus function just to have a minimal repro
function test(p: any) {
'use strong';
'use strict';
p = {prop: p} = p;
}Expected behavior:
function test(p) {
'use strong';
'use strict';
var _a;
p = (_a = p, p = _a.prop, _a);
}Actual behavior:
function test(p) {
'use strong';
var _a;
'use strict';
p = (_a = p, p = _a.prop, _a);
}The transpiled code has different semantics, because 'use strict' is no longer treated as directive.
I don't know if this also affects other transformers that add statements.
Note that TypeScript correctly detects the 'use strict' directive and would correctly complain about octal literals.
Playground Link:
Related Issues:
#24582
#24386 (comment)
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do this