Typescript: Automatically include `types` and `node_modules\@types` in the compilation

Created on 24 Apr 2016  ·  6Comments  ·  Source: microsoft/TypeScript

Along with https://github.com/Microsoft/TypeScript/issues/8255, we should remove the support for "types" in tsconfig.json, and include types, node_modules\@types by default in the compilation instead.

this should simplify the acquisition of global types to:

npm install @types\jquery
@types Committed Suggestion

Most helpful comment

:rocket: :guitar: Blog post time! :rose:

All 6 comments

This is a great idea. Is this the only place there is discussion about installing types via npm? This was mentioned at ng-conf last week, and this is the only place I have seen it documented.
I am giving a presentation on authoring .d.ts files at the OpenWest conference in July, and I would like to make sure that I consider this as I prepare my presentation.
I found this: https://www.npmjs.com/~types , which I assume would be the place to go for typings using this functionality. It appears that everything there now is coming from DefinitelyTyped. Is DefinitelyTyped going to be the source going forward for installing typings in this way? I know that @blakeembrey has put a lot of effort into the https://github.com/typings/typings project to enable installation of typings from other places other than DefinitelyTyped.
It would be really nice if some proposal was drafted about how the typings will be composed (external modules or es6 modules), as well as where they live and how they will be packaged. I could take a crack at it, but I'm sure that there are others that know more about what is being planned for this. If anyone could point me in the right direction, that would be great :)

@joeskeen We are currently working on updating the typing acquisition story. we do not have a fully documented workflow yet. Here are some highlights of the plan:

  • NPM as the main package distribution mechanism
  • No need for other tools to acquire type definition files
  • Packages could carry their definition files, e.g. typescript, and angular, or it would be available at @types\packageName
  • Module resolution in the compiler supports looking for both locations seamlessly
  • Packages should declare their dependencies as npm dependencies
  • Definitelytyped stays as the main source of declaration files, with the ability to redirect to other sources
  • Native support for UMD modules

What we are working on now:

  • update definition files to use UMD pattern and avoid global scope pollution
  • automatically publish to @types from definitllytyped
  • add a simple typings search utilities to be used in different tools/IDEs

We have been working closely with @blakeembrey on this, and once we have the infrastructure ready typingscli should start supporting it.

we should also be posting a full documentation of what has been done, and how to consume type definitions moving forward.

you can see more about what is being done on this front under the label: typings, see https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=label%3ATypings+

Thanks @mhegazy for taking the time for that update! :)

:rocket: :guitar: Blog post time! :rose:

Is there any way to append (rather than override) definition files to the default types value?

what do you mean by "append"? by default all visible types packages are included.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DanielRosenwasser picture DanielRosenwasser  ·  3Comments

CyrusNajmabadi picture CyrusNajmabadi  ·  3Comments

MartynasZilinskas picture MartynasZilinskas  ·  3Comments

manekinekko picture manekinekko  ·  3Comments

fwanicka picture fwanicka  ·  3Comments