How to configure a Sublime Build System for TypeScript

前端 未结 2 1994
有刺的猬
有刺的猬 2020-12-05 21:11

I\'m looking to configure a Build System in Sublime Text for TypeScript.

I\'m currently using...

{
  \"cmd\": [\"tsc\", \"$file\"],
  \"selector\": \         


        
相关标签:
2条回答
  • 2020-12-05 21:50

    There are two versions now. This one, or this one. Creating your own is easy, by referring to this document.

    0 讨论(0)
  • 2020-12-05 22:10

    Use this on OS-X:

    {
        "cmd": ["tsc","$file"],
        "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
        "selector": "source.ts",
        "osx": {
           "path": "/usr/local/bin:/opt/local/bin"
        }
    }
    

    EDIT:

    Here is the Sublime Build System created for Windows. Tested and working as expected. However you need to include tsc.cmd path in the windows environment, otherwise you should define the root to the Typescript command in the cmd section below:

    {
        "cmd": ["tsc","$file"],
        "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
        "selector": "source.ts",
    
        "windows": {
            "cmd": ["tsc.cmd", "$file"]
        }
    }
    
    0 讨论(0)
提交回复
热议问题