Skip to content

Allow to run TypeScript (Compiler, Services) in strict mode #9449

Closed

Description

TypeScript Version: master

Currently, tsc.js, typescriptServices.js and tsserver.js cannot be run in a strict mode environment due to using the identifier static in checker.ts.

static is a reserved identifier in strict mode, so if you run tsc.js with Node in strict mode, it will fail:

C:\Users\VPC\Desktop\TypeScriptOrg\built\local>node --use_strict tsc.js
C:\Users\VPC\Desktop\TypeScriptOrg\built\local\tsc.js:24019
                    var static = ts.forEach(member.modifiers, function (m) { return m.kind === 113; });
                        ^^^^^^
SyntaxError: Unexpected strict mode reserved word

I think it is reasonable to allow TypeScript to be run in a strict mode environment, by changing the name of the variable.

PS: Is there a reason why the TypeScript sources don't use strict mode in general?
Thanks!

Activity

  1. modified the milestone: on Jun 30, 2016
  2. HerringtonDarkholme commented on Jul 1, 2016

    @HerringtonDarkholme
    Contributor

    I also encounter this when trying to compress typescript services using Closure compiler.

    Mohamed Hegazy (@mhegazy) can I submit a pull request for this? Or you prefer to do it yourself?

  3. added a commit that references this issue on Jul 1, 2016
    0a682f1
  4. mhegazy commented on Jul 1, 2016

    @mhegazy
    Contributor
  5. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions