Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run TypeScript (Services) in strict mode #10755

Closed
kpreisser opened this issue Sep 7, 2016 · 3 comments
Closed

Allow to run TypeScript (Services) in strict mode #10755

kpreisser opened this issue Sep 7, 2016 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@kpreisser
Copy link
Contributor

kpreisser commented Sep 7, 2016

Hi,
this is a follow-up issue to #9449.

TypeScript Version: master (4685646)

After PR #9353 has been merged, typescriptServices.js (in this case) again cannot be run in strict mode due to using the identifier package in services.ts, which is a reserved word in strict mode:

C:\Users\VPC\Desktop\TypeScript\built\local>node --use_strict typescriptServices.js
C:\Users\VPC\Desktop\TypeScript\built\local\typescriptServices.js:68849
                        var package = _d[_c];
                            ^^^^^^^
SyntaxError: Unexpected strict mode reserved word

(running current master)

As @HerringtonDarkholme noted, this causes an error in the Closure Compiler.

Now that TSC requires at least ES5 (#10125), might there be an option to add "use strict"; to the ts files of the TypeScript repo? This should prevent using such reserved identifiers.

Thanks!

@mhegazy
Copy link
Contributor

mhegazy commented Sep 7, 2016

I have a fix to remove the use of package in #10757. the longer term change is to add a new flag to parse a project in strict mode.

@mhegazy mhegazy added the Bug A bug in TypeScript label Sep 7, 2016
@mhegazy mhegazy self-assigned this Sep 7, 2016
@mhegazy mhegazy closed this as completed in 9ee897a Sep 7, 2016
mhegazy added a commit that referenced this issue Sep 7, 2016
Fix #10755: remove uses of `package` as an identifier name
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Sep 7, 2016
@mhegazy mhegazy added this to the TypeScript 2.1 milestone Sep 7, 2016
@kpreisser
Copy link
Contributor Author

Thanks!

@mhegazy
Copy link
Contributor

mhegazy commented Sep 7, 2016

Filed #10758 to track adding the compiler option.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

2 participants