javascript - Get Angular 2 .ts files instead of .d.ts files -
when work angular2 code need see implementation of class, let's router
class.
if click on router
type in ide webstorm, e. g. inside constructor of class
export class myclass { constructor(private router: router) {} // ... }
my ide takes me typescript definition file router.d.ts
inside node_modules
folder. want take me original router.ts
file implementation of router class, not definition.
the original .ts
file not included in node_modules
folder structure when angular2 github via standard package.json suggested in angular2 quickstart. currently, have original code in the official github repo.
any ideas how .ts
files node_modules/@angular
folder instead of .d.ts
files?
sadly, it's not possible since no ts files exist. if add them still not possible since import real angular paths point definition files. on top of file structure of project not correlate structure of import string literals.
some background , more information
the npm package not include .ts
files, design angular team. until time ago .ts
files indeed supplied npm package.
the reasoning removing them disable abuse users accessing private classes , @internal
, private apis public methods/properties in api not supposed public must other angular internal classes can use them.
we used see lot of code samples out there doing things import { promisecompleter } 'angular2/src/facade/lang';
(before rc0) changed when project structure had big structure refactor in rc0. abuse wide , it's bad, bad... users , angular pr.
the angular project has complex , robust build process of api moved .ts
files d.ts
files using automated process limits exposure. (public_api_guard)
the end result d.ts
files only.
it's not possible clone git repo , use since, again, file structure way way different imports have change. importantly without build angular will, likely, not work.
a solution using different approach
however, if debug app notice reach actual angular core .ts
files in source view of console, because npm package comes source map files include whole ts source code. nice trick did there.
this use dig deep angular, works quite great , lot it. it's not nice goto declaration
something... imo it's easier understand when step through code...
Comments
Post a Comment