Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property '0' of null #1

Open
cherrydev opened this issue Dec 31, 2014 · 3 comments
Open

Cannot read property '0' of null #1

cherrydev opened this issue Dec 31, 2014 · 3 comments

Comments

@cherrydev
Copy link

Even a trivial test of this plugin gives me the error:

      var paramsArray = params[0].split('\n');
                              ^
TypeError: Cannot read property '0' of null

At index.js:47:31

Looking at your source code, it appears that you're simply searching for text patterns, which I suspect is very limiting and fragile. If anyone is interested in continuing to develop and maintain this sort of functionality, I recommend that they investigate using the actual typescript compiler API, which has the ability to walk the parsed SyntaxTree and transform it. This API is used by the gulp-typescript and tslint modules if you're looking for examples, but is sadly lacking in real documentation or examples from MS. In addition both the "typescript.api" and "typescript-api" modules appear abandoned and are not up-to-date with the compiler apis. MS's "documentation" is simply this page.

@mattduffield
Copy link
Owner

It appears that you don't understand the purpose of this package. It was
based off a package that I saw doing the same thing for CoffeeScript and I
wanted to implement the same thing for TypeScript + Angular projects.

It is not using the TypeScript compiler at as it is trying to provide some
syntactical sugar to the development workflow.

Thanks for your interest,

Matt

On Wed, Dec 31, 2014 at 4:11 PM, cherrydev notifications@github.com wrote:

Even a trivial test of this plugin gives me the error:

  var paramsArray = params[0].split('\n');
                          ^

TypeError: Cannot read property '0' of null

At index.js:47:31

Looking at your source code, it appears that you're simply searching for
text patterns, which I suspect is very limiting and fragile. If anyone is
interested in continuing to develop and maintain this sort of
functionality, I recommend that they investigate using the actual
typescript compiler API, which has the ability to walk the parsed
SyntaxTree and transform it. This API is used by the gulp-typescript and
tslint modules if you're looking for examples, but is sadly lacking in real
documentation or examples from MS. In addition both the "typescript.api"
and "typescript-api" modules appear abandoned and are not up-to-date with
the compiler apis. MS's "documentation" is simply this
https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
page.


Reply to this email directly or view it on GitHub
#1.

@cherrydev
Copy link
Author

Yes, I understand that it is based off of ng-classify and I think it would be useful to provide the same functionality for Typescript. If you read the source of the ng-classify module (for example here) you'll see that it uses the coffeescript compiler service itself to parse the .coffee files to search for the appropriate classes rather than attempting to parse the files unassisted. This is analogous to what I'm suggesting.

@mattduffield
Copy link
Owner

Okay,

Sorry for jumping to the wrong conclusion. Yes, I 100% agree that this
should be done. It was a sample that I wrote and put up so that I could get
back to it when I had time but using the compiler to aid in this makes
perfect sense.

Matt

On Wed, Dec 31, 2014 at 4:27 PM, cherrydev notifications@github.com wrote:

Yes, I understand that it is based off of ng-classify and I think it would
be useful to provide the same functionality for Typescript. If you read the
source of the ng-classify module (for example here
https://github.com/CaryLandholt/ng-classify/blob/master/lib/classDetails.coffee)
you'll see that it uses the coffeescript compiler service itself to parse
the .coffee files to search for the appropriate classes rather than
attempting to parse the files unassisted. This is analogous to what I'm
suggesting.


Reply to this email directly or view it on GitHub
#1 (comment)
.

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

No branches or pull requests

2 participants