     (lambda (key) (define-key typescript-mode-map key nil)))
 
   )
+
+
+(use-package tide
+  :ensure t
+  :config
+  (defun setup-tide-mode ()
+    (interactive)
+    (tide-setup)
+
+    (flycheck-mode)
+    (setq flycheck-check-syntax-automatically '(save mode-enabled))
+    (tide-hl-identifier-mode)
+
+    ;; Rely on tide for formatting
+    (aggressive-indent-mode 0)
+
+    (local-set-key (kbd "C-,") #'tide-fix))
+
+  ;; aligns annotation to the right hand side
+  (setq company-tooltip-align-annotations t)
+
+  ;; formats the buffer before saving
+  (add-hook 'before-save-hook #'tide-format-before-save)
+
+  (add-hook 'typescript-mode-hook #'setup-tide-mode))

    ((error line-start (file-name) "(" line "," column "): error " (message) line-end))
    :next-checker (typescript-tslint)
    :modes (typescript-mode))

  (add-to-list 'flycheck-checkers 'typescript-tsc)

  (add-hook 'typescript-mode-hook #'flycheck-mode)

  ;; Parse typescript compiler output
  (require 'compile)

  (end-of-line)
  (insert "\n")
  (yas-expand-snippet (yas-lookup-snippet "import")))


(use-package typescript-mode
  :ensure t

  :config

  (require 'flycheck)
  (require 'ds-js)
  (require 'typescript-mode)

