0

I've updated my project to TypeScript 2 and it's all good. I'm using the new way to use typings, now stored in node_modules/@types.

The problem is that installing new typings doesn't automatically work with Sublime. I have to manually add the references to have them recognized inside the editor.

Is there a convenient solution to my problem?

Edit: Duplicate of: How should I use @types with TypeScript 2

Community
  • 1
  • 1
Guilhem Soulas
  • 1,975
  • 2
  • 18
  • 30
  • Possible duplicate of [How should I use @types with TypeScript 2](http://stackoverflow.com/questions/38444279/how-should-i-use-types-with-typescript-2) – Gerard Roche Sep 29 '16 at 04:19

1 Answers1

0

Inside your tsconfig.json try adding typeRoots & types for the location of the typings and what types should be referenced. Like this: "typeRoots": [ "../node_modules/@types" ]

"types": [
  "jasmine",
]

` See if that works.

Nico
  • 1,961
  • 17
  • 20
  • For some reason, my Sublime is not able to find the types this way :( – Guilhem Soulas Sep 28 '16 at 21:00
  • Well you are on Typescript version 2.0 https://www.typescriptlang.org/docs/handbook/compiler-options.html Is the path to your node_modules correct? If it is in `src/client/app` then you would need `'.../.../node_modules/@types'` or if your `tsconfig.json` is on the root then it would be `'./node_modules/@types'` – Nico Sep 29 '16 at 01:28
  • Could you try and include the missing type *package name* inside your `types : []` It is a list of names of type definitions to include. Was this what you meant by manually entering the references? – Nico Sep 29 '16 at 13:52