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 5K
  • Win 3K
  • OS X 2K
  • Linux 741
Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15
Windows 2 6 6 13 13 11 8 4 3 9 12 15 9 9 10 3 5 10 10 10 11 2 8 7 17 9 11 13 4 4 11 10 17 7 10 7 4 9 10 14 8 10 3 6 11 9
OS X 0 6 12 11 4 10 5 5 2 12 12 5 7 6 4 5 8 7 2 8 4 2 5 11 5 12 7 6 7 7 5 4 5 5 5 0 4 7 9 7 4 10 3 3 2 4
Linux 0 2 0 2 4 0 1 3 9 1 3 2 0 2 2 4 2 2 0 3 1 1 8 4 4 1 1 0 2 1 1 0 1 1 2 1 4 4 7 1 1 3 0 5 1 1

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.