ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Better Type​Script

by lavrton ST3

Typescript syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more for Sublime Text.https://github.com/lavrton/sublime-better-typescript

Details

Installs

  • Total 7K
  • Win 3K
  • OS X 2K
  • Linux 939
Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13
Windows 8 8 10 11 21 15 15 11 8 6 5 16 15 16 18 1 6 16 15 13 19 7 8 10 10 15 9 14 15 7 7 13 13 15 22 18 15 7 15 6 12 15 23 5 16 10
OS X 9 6 4 8 10 8 18 9 5 6 11 13 11 13 12 6 4 11 11 10 26 24 7 7 10 9 11 17 12 8 8 12 15 13 14 16 5 10 10 10 15 8 13 7 16 14
Linux 4 0 3 3 4 2 6 5 5 0 5 4 6 5 1 3 3 5 9 5 1 6 1 2 3 3 3 7 4 7 0 5 5 3 4 5 8 6 7 5 1 4 5 1 2 9

Readme

Source
raw.​githubusercontent.​com

Better Typescript

Overview

This package is for Sublime Text 3.

Description

This is fork of Better CoffeeScript but adopted for work with Typescript. Also look at this TypeScript plugin for Sublime Text https://github.com/Railk/T3S. It is really awesome.

Installation

If you have Sublime Package Control, you know what to do. If not, well: it's a package manager for Sublime Text 3; it's awesome and you can read about it here. Installation guide can be found here.

  • Open the Command Pallete (ctrl+shift+P or cmd+shift+P).
  • Type “Install Package” and hit return.
  • Type “Better TypeScript” and hit return.

Build File Example

Current package don't have sublime build file. You can create it by yourself and save it (Preferences - Browse Packages... - User folder) as Typescript.sublime-build. Then use Cmd + B to build your file.

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

Commands/Shortcuts

You can access the commands either using the command palette (ctrl+shift+P or cmd+shift+P) or via shortcuts.

alt+shift+s - Run a syntax check
alt+shift+c - Compile a file
alt+shift+d - Display compiled JavaScript
alt+shift+w - Toggle watch mode

Context menu has Compile Output that compiles the current TypeScript and outputs the javascript code that is run, in a panel.

Note: Some of the commands use the Status Bar for output, so you'll probably want to enable it (View » Show Status Bar).

Snippets

  • Use TAB to run a snippet after typing the trigger.
  • Use TAB and shift+TAB to cycle forward/backward through fields.
  • Use ESC to exit snippet mode.

Thanks @MattSeen to provide Snippets (https://github.com/MattSeen/Sublime-TypeScript-Snippets)

Settings

Go to Preferences > Package Settings > Better TypeScript > Settings - User to change settings.

See Preferences > Package Settings > Better TypeScript > Settings - Default to see all available settings.

FAQ

Most of the linux terminal commands written here can be run via cygwin - aka Linux Terminal in Windows.

  • Most of the problems are related to configurations. Remember to configure binDir after you install!

  • Do I have tsc installed?

Try finding tsc in your global npm list with npm ls -g | grep tsc which will output something like:

npm ls -g | grep tsc
  • Where can I find out the path to tsc binary?

In Linux which command will tell you where a command originates from. In terminal type:

which tsc
# /usr/bin/tsc

This path will go into the binDir setting.