question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve documentation for TypeScript support

See original GitHub issue

In TypeScript, to do dependency injection, we must statically include the $inject variable into each class. It would be great if ng-annotation would automatically recognize all TypeScript classes that are acting as Angular components and then inject the static $inject variable beside the constructor.

BEFORE INJECTION:

class MyDirective { 
constructor($scope:any,service:MyService)
      {

      }
 }

AFTER INJECTION:

class MyDirective { 
 static $inject = ["$scope","MyService"]; 
 constructor($scope:any,service:MyService)
      {

      }
 }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
olovcommented, Dec 19, 2015

The README is now very clear that it is preferred to use "ngInject"; with TypeScript. Closing

1reaction
szahncommented, Jul 6, 2015

I see that the readme states that TypeScript is supported, however a sub-heading with sample code on annotating a constructor would have been useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documenting Your TypeScript Projects: There Are Options
In this article, I'm going to cover a few tools that will help you document your TypeScript projects. Good code does not need...
Read more >
JSDoc Reference - TypeScript: Documentation
JSDoc Reference. The list below outlines which constructs are currently supported when using JSDoc annotations to provide type information in JavaScript files.
Read more >
TypeScript + JSDoc = better-docs - Wojciech Krysiak - Medium
Documentation generated by better-docs looks very well (screenshots below) · It is based on JSDoc — a stable tool created a long time...
Read more >
Improve README documentation for TypeScript usage #467
ts-node supports third-party transpilers as plugins. Transpilers such as swc can transform TypeScript into JavaScript much faster than the ...
Read more >
Generating Documentation for TypeScript Projects
These annotations are all optional and the more you add, the more the compiler can help you. Compiling the TypeScript version results in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found