# Typescript project on SonarCloud doesn't recognize lines of code?

**URL:** <https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049>\
**Category:** SonarQube Cloud\
**Created:** [February 12, 2020, 7:46pm UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049 "2020-02-12T19:46:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Justason](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/scott_justason/32/9261_2.png) [@Scott\_Justason](https://community.sonarsource.com/u/Scott_Justason)\
**Post date:** [February 12, 2020, 7:46pm UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049/1 "2020-02-12T19:46:13Z")

</div>

Template for a good new topic, formatted with [Markdown](https://commonmark.org/help/):

- ALM used (GitHub, Bitbucket Cloud, Azure DevOps)  
Github
- CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI  
CircleCI
- Scanner command used when applicable (private details masked)  
Used SonarClouds built in integration with Github private repo
- Languages of the repository  
Typescript, Javascript
- Only if the SonarCloud project is public, the URL
  - And if you need help with pull request decoration, then the URL to the PR too

- Error observed (wrap logs/code around with triple quotes ``` for proper formatting)  
When I push the typescript project using the command line sonar-scanner to our SonarCloud account, it correctly identifies all the Typescript file as “lines of code”, but when I integrated the exact same project to our Github account, it recognized only the Javascript files as “lines of code” and the rest of the Typescript as simply “lines” (and so no analysis was done) (will attach pic)
- Steps to reproduce  
Integrate Typescript project using SonarCloud’s Github integration?
- Potential workaround  
Manually push from the command line or create a new build step to automate this.

![Screen Shot 2020-02-06 at 11.31.02 AM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/0/0fce9e89adc2309ddd1f25c4fa8d201de680999c.png)

---

<div class="post-metadata">

**Author:** ![TomVanBraband](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/tomvanbraband/32/46480_2.png) [@TomVanBraband](https://community.sonarsource.com/u/TomVanBraband)\
**Post date:** [February 13, 2020, 7:49am UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049/2 "2020-02-13T07:49:39Z")

</div>

Hello @Scott_Justason,

Could you navigate to _Administration \> Background Tasks_ on the project page on SonarCloud and give me the ID of a background task that did not pick-up the TypeScript files?

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![timster01](https://avatars.discourse-cdn.com/v4/letter/t/a5b964/32.png) [@timster01](https://community.sonarsource.com/u/timster01)\
**Post date:** [February 13, 2020, 2:16pm UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049/3 "2020-02-13T14:16:06Z")

</div>

Just a suggestion, since I have personally been dealing with typescript issues, is that sonarcloud uses the typescript dependency in your projects node\_modules folder. It is very likely that this dependency is not actually installed during your Github CI but is when you scan it on your PC from the CLI. This means sonarcloud will not analyze typescript in your project on Github. If you run npm install on your project during your CI run before analysis that will solve the problem, if this is indeed what is actually going wrong here.

---

<div class="post-metadata">

**Author:** ![Scott\_Justason](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/scott_justason/32/9261_2.png) [@Scott\_Justason](https://community.sonarsource.com/u/Scott_Justason)\
**Post date:** [February 13, 2020, 9:39pm UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049/4 "2020-02-13T21:39:17Z")

</div>

Hi Tom,

Here is an ID AXAWOm7oQclT7Ra-u5d7. Basically its any of them because none of the Typescript files are ever picked up.

Thanks,  
Scott

---

<div class="post-metadata">

**Author:** ![Scott\_Justason](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/scott_justason/32/9261_2.png) [@Scott\_Justason](https://community.sonarsource.com/u/Scott_Justason)\
**Post date:** [February 13, 2020, 9:42pm UTC](https://community.sonarsource.com/t/typescript-project-on-sonarcloud-doesnt-recognize-lines-of-code/20049/5 "2020-02-13T21:42:04Z")

</div>

Hi Tim,

I have another project integrated in the same way (to the Github repo directly), with no CI involved on either. That other project does pick up the Typescript files correctly, so I wonder if something went wrong during the initial integration. I read some posts about the same thing you’re suggesting, but I think with the direct Github integration it just needs a package.json that has Typescript as a dependency… at least it works with the other project.

Thanks
