# Sonar cli fails on adding allowImportingTsExtensions in tsconfig.json

**URL:** <https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847>\
**Category:** SonarQube Server / Community Build\
**Tags:** typescript\
**Created:** [June 1, 2023, 8:22am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847 "2023-06-01T08:22:12Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![harsha509](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@harsha509](https://community.sonarsource.com/u/harsha509)\
**Post date:** [June 1, 2023, 8:22am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/1 "2023-06-01T08:22:12Z")

</div>

sonar fails on adding `allowImportingTsExtensions` in tsconfig.json. it skips all ts file for scanning.

log: (due to project guidelines cannot paste complete log in here) but below is the sample

INFO: Creating TypeScript program  
NFO: TypeScript configuration file /builds/automation/tsconfig.json  
INFO: 209 source files to be analyzed  
ERROR: Error: Unknown compiler option ‘allowImportingTsExtensions’.

and sonar fails to scan all src ts files

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [June 2, 2023, 1:52pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/2 "2023-06-02T13:52:17Z")

</div>

Hi,

Welcome back.

What’s your SonarQube version?

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![harsha509](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@harsha509](https://community.sonarsource.com/u/harsha509)\
**Post date:** [June 3, 2023, 5:38am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/3 "2023-06-03T05:38:35Z")

</div>

HI,

its Developer Edition - Version 10.0 (build 68432)

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [June 5, 2023, 1:21pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/5 "2023-06-05T13:21:21Z")

</div>

Hi,

Thanks for the update. I’ve flagged this for the language experts.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![harsha509](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@harsha509](https://community.sonarsource.com/u/harsha509)\
**Post date:** [June 9, 2023, 5:33am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/6 "2023-06-09T05:33:56Z")

</div>

Thanks Ann,

Do we have any workaround for now ?

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [June 9, 2023, 8:30am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/7 "2023-06-09T08:30:16Z")

</div>

Hi,

this happens because we don’t yet support TypeScript 5. We should release it in a couple of days. If you need a workaround urgently, you could create another tsconfig file without this option, which would be used only for analysis.

---

<div class="post-metadata">

**Author:** ![harsha509](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@harsha509](https://community.sonarsource.com/u/harsha509)\
**Post date:** [June 14, 2023, 3:32pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/9 "2023-06-14T15:32:17Z")

</div>

Hi,

Thanks for the inputs. Creating separate tsconfig is for sonar not an option for us currently!

may be I will wait for the Sonar release, Could you please let me know when it will be released?

Thanks,  
Sri

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [June 14, 2023, 5:40pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/10 "2023-06-14T17:40:28Z")

</div>

Hi Sri,

At the bottom of [this page](https://www.sonarsource.com/products/sonarqube/) you can sign up to get notifications of new SQ releases.

&nbsp;  
HTH,  
Ann

---

<div class="post-metadata">

**Author:** ![Davit\_Sargsyan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/davit_sargsyan/32/46952_2.png) [@Davit\_Sargsyan](https://community.sonarsource.com/u/Davit_Sargsyan)\
**Post date:** [January 24, 2024, 6:21am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/13 "2024-01-24T06:21:38Z")

</div>

Hello . Can you please help with this approach ? How should I configure SonarQube to use that second file ?

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [January 24, 2024, 8:54am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/14 "2024-01-24T08:54:14Z")

</div>

hi @Davit_Sargsyan ,

use the `sonar.typescript.tsconfigPaths` property, either in the config or the UI

---

<div class="post-metadata">

**Author:** ![Davit\_Sargsyan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/davit_sargsyan/32/46952_2.png) [@Davit\_Sargsyan](https://community.sonarsource.com/u/Davit_Sargsyan)\
**Post date:** [January 25, 2024, 7:06am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/15 "2024-01-25T07:06:54Z")

</div>

@saberduck I’m adding this configuration to my sonar-project.properties . But it doesn’t work anyway

sonar.typescript.tsConfigPath=./tsconfig.sonar.json  
sonar.typescript.tsConfigPath=tsconfig.sonar.json  
sonar.typescript.tsConfigPaths=tsconfig.sonar.json  
sonar.typescript.tsConfigPaths=./tsconfig.sonar.json

---

<div class="post-metadata">

**Author:** ![saberduck](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/saberduck/32/27_2.png) [@saberduck](https://community.sonarsource.com/u/saberduck)\
**Post date:** [January 25, 2024, 3:07pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/16 "2024-01-25T15:07:48Z")

</div>

could you please share debug logs?

---

<div class="post-metadata">

**Author:** ![Davit\_Sargsyan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/davit_sargsyan/32/46952_2.png) [@Davit\_Sargsyan](https://community.sonarsource.com/u/Davit_Sargsyan)\
**Post date:** [January 25, 2024, 4:09pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/17 "2024-01-25T16:09:21Z")

</div>

sure . please see attached . Seems like it still keeps reference to the original tsconfig.json file

INFO: 1167 source files to be analyzed

ERROR: Error: Unknown compiler option ‘allowImportingTsExtensions’.

ERROR: Failed to create program: Unknown compiler option ‘allowImportingTsExtensions’.  
INFO: Creating TypeScript program (done) | time=82ms  
INFO: Skipped 1167 file(s) because they were not part of any tsconfig (enable debug logs to see the full list)  
INFO: 1167/1167 source files have been analyzed

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 25, 2024, 6:43pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/18 "2024-01-25T18:43:16Z")

</div>

Hi,

Could you please provide the full, verbose log? [This guide](https://community.sonarsource.com/t/how-to-find-logs-about-importing-code-coverage/73317) will help you find them.

&nbsp;  
Thx,  
Ann

---

<div class="post-metadata">

**Author:** ![gab](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gab/32/72206_2.png) [@gab](https://community.sonarsource.com/u/gab)\
**Post date:** [January 26, 2024, 8:41am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/19 "2024-01-26T08:41:44Z")

</div>

@Davit_Sargsyan is there a chance you are using an old version of SonarQube?

The compiler option `allowImportingTsExtensions` was introduced in TypeScript 5.

TypeScript 5 has been supported since SonarQube 10.1 and SonarCloud at the same time, since June 2023.

You can see [the docs](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/javascript-typescript-css/) for language support.

---

<div class="post-metadata">

**Author:** ![Davit\_Sargsyan](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/davit_sargsyan/32/46952_2.png) [@Davit\_Sargsyan](https://community.sonarsource.com/u/Davit_Sargsyan)\
**Post date:** [January 26, 2024, 9:15am UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/20 "2024-01-26T09:15:41Z")

</div>

@ganncamp@gab thanks for your replies . I’ve resolved the problem with creating second tsconfig file . But now I’m facing to another issue . For some reasons SonarQube doesn’t see my coverage/lcov.info file

 ![Screen Shot 2024-01-26 at 13.15.11](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/1/d/1dbcf55c6a3b6a503b5d1a1c6a907e81b2a1e9f7.png)

and here’s my conf file line for path

sonar.javascript.lcov.reportPaths=coverage/lcov.info

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 26, 2024, 1:40pm UTC](https://community.sonarsource.com/t/sonar-cli-fails-on-adding-allowimportingtsextensions-in-tsconfig-json/91847/21 "2024-01-26T13:40:41Z")

</div>

Hi,

I’m glad you worked through your initial problem. LCov is a new question & it deserves its own thread.

&nbsp;  
😃  
Ann
