Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Support for in-browser type-checking #123

Closed
frankwallis opened this issue Jan 25, 2016 · 4 comments
Closed

Support for in-browser type-checking #123

frankwallis opened this issue Jan 25, 2016 · 4 comments
Labels

Comments

@frankwallis
Copy link

I am the maintainer of plugin-typescript which is the systemjs typescript plugin. The plugin currently supports type-checking in the browser when using /// <reference /> as it is able to load all the declaration files and feed them to the compiler. This provides quite a nice workflow for small projects as no bundler is required.

With the introduction of 'typings' there is a bit of a problem because from the browser it is very difficult to locate the typings file or even know whether it exists. As you know the algorithm for finding a typings file can involve searching a directory (for reference it's here). What you need in the browser is a prepopulated map of module name to typings file, something like:

   "angular2": {
        "default": "./typings/browser/angular2/angular2.d.ts",
         "router": "./typings/browser/angular2/router.d.ts",
    },
    "rxjs": "./typings/browser/rxjs/rxjs.d.ts"

So I was wondering if there is any way I can get this information using the typings project, or if you would consider outputting this information into typings.json if it is already available? If you think it's going to be possible then I am more than happy to create a pull request. This is actually a real problem for me at the moment, so any help would be much appreciated, thanks.

@blakeembrey
Copy link
Member

I guess I need a bit more context and information. Is this related to Typings or resolving the TypeScript supported resolution? In any case, it's possible to do. There's a main.d.ts file that is accessible that has all the installed references, but it also sounds like you're after not-installed references but module references?

@frankwallis
Copy link
Author

The actual problem I am trying to solve is how to automatically load the angular2 typings files which are distributed with the npm package. I need to implement something like moduleResolution: node but from the browser and this means I cannot search the file system like npm does. Either the typings files distributed within packages need to be available in a configuration file somewhere, or they need to be converted into 'normal' ambient references.

@blakeembrey
Copy link
Member

Ok, I'm happy to hear suggestions of how it should look. There'll be a "manifest" in future releases and it's possible this would be part of that implementation.

@blakeembrey
Copy link
Member

Closing with lack of movement. Feel free to continue the discussion, keep an eye out of future changes in the manifest file support.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants