# Typescript 3.7 broke plugin builds

**URL:** https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141
**Category:** Uncategorized
**Created:** [January 7, 2020, 7:21pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141 "2020-01-07T19:21:06Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 7, 2020, 7:21pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/1 "2020-01-07T19:21:06Z")

</div>

I decided I wanted to take advantage of the latest typescript features, most importantly optional chaining. Has anyone run into issues with a previously working project but no longer compiles with the latest TS. Are there some config changes I need to turn off to let the TS compiler work the old way in some cases?

A brand new cli project will build just fine. I’m just wondering if anyone has run into any issues.

---

<div class="post-metadata">

### Author: ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)
#### Post date: [January 7, 2020, 7:45pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/2 "2020-01-07T19:45:45Z")

</div>

well, at least post the error message here? It may or may not be related to Aurelia at all

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 7, 2020, 7:52pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/3 "2020-01-07T19:52:19Z")

</div>

This actually occurs when building a plugin, not a regular build.

```auto
  { uid: 6,
  name: 'processPluginJavaScript',
  branch: false,
  error:
   { Error: TypeScript: Compilation failed
       at Output.mightFinish (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:131:43)
       at applySourceMap.then.appliedSourceMap (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:66:22)
     domainEmitter:
      CompileStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: true,
        js: [CompileOutputStream],
        dts: [CompileOutputStream],
        project: [Object] },
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     domainThrown: false },
  duration: [12, 988290899],
  time: 1578426596305 }
{ uid: 2,
  name: '<parallel>',
  branch: true,
  error:
   { Error: TypeScript: Compilation failed
       at Output.mightFinish (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:131:43)
       at applySourceMap.then.appliedSourceMap (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:66:22)
     domainEmitter:
      CompileStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: true,
        js: [CompileOutputStream],
        dts: [CompileOutputStream],
        project: [Object] },
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     domainThrown: false },
  duration: [13, 37538601],
  time: 1578426596352 }
{ uid: 0,
  name: '<series>',
  branch: true,
  error:
   { Error: TypeScript: Compilation failed
       at Output.mightFinish (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:131:43)
       at applySourceMap.then.appliedSourceMap (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:66:22)
     domainEmitter:
      CompileStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: true,
        js: [CompileOutputStream],
        dts: [CompileOutputStream],
        project: [Object] },
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     domainThrown: false },
  duration: [13, 201864600],
  time: 1578426596459 }
TypeScript: 3 semantic errors
TypeScript: emit succeeded (with errors)
{ uid: 10,
  name: 'processPluginJavaScript',
  branch: false,
  error:
   { Error: TypeScript: Compilation failed
       at Output.mightFinish (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:131:43)
       at applySourceMap.then.appliedSourceMap (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:66:22)
     domainEmitter:
      CompileStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: true,
        allowHalfOpen: true,
        js: [CompileOutputStream],
        dts: [CompileOutputStream],
        project: [Object] },
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     domainThrown: false },
  duration: [13, 175219300],
  time: 1578426596493 }
{ Error: TypeScript: Compilation failed
    at Output.mightFinish (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:131:43)
    at applySourceMap.then.appliedSourceMap (D:\Source\aurelia\aurelia-syncfusion-ej2-bridge\node_modules\gulp-typescript\release\output.js:66:22)
  domainEmitter:
   CompileStream {
     _readableState:
      ReadableState {
        objectMode: true,
        highWaterMark: 16,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: [Pumpify],
        pipesCount: 1,
        flowing: true,
        ended: true,
        endEmitted: false,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        paused: false,
        emitClose: true,
        autoDestroy: false,
        destroyed: false,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: true,
        decoder: null,
        encoding: null },
     readable: true,
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        members: [],
        [Symbol(kWeak)]: WeakReference {} },
     _events:
      [Object: null prototype] { finish: [Function], end: [Function], data: [Function: ondata] },
     _eventsCount: 3,
     _maxListeners: undefined,
     _writableState:
      WritableState {
        objectMode: true,
        highWaterMark: 16,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: false,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        emitClose: true,
        autoDestroy: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: true,
     allowHalfOpen: true,
     js:
      CompileOutputStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object: null prototype] {},
        _eventsCount: 0,
        _maxListeners: undefined },
     dts:
      CompileOutputStream {
        _readableState: [ReadableState],
        readable: true,
        domain: [Domain],
        _events: [Object: null prototype] {},
        _eventsCount: 0,
        _maxListeners: undefined },
     project:
      { input: [FileCache],
        singleOutput: false,
        compiler: [ProjectCompiler],
        options: [Object],
        projectReferences: undefined,
        typescript: [Object],
        directory: 'D:\\Source\\aurelia\\aurelia-syncfusion-ej2-bridge',
        output: [Output],
        reporter: [Object] } },
  domain:
   Domain {
     domain: null,
     _events:
      [Object: null prototype] {
        removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture] },
     _eventsCount: 2,
     _maxListeners: undefined,
     members: [],
     [Symbol(kWeak)]: WeakReference {} },
  domainThrown: false }

```

---

<div class="post-metadata">

### Author: ![michaelw85](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/michaelw85/32/1317_2.png) [@michaelw85](https://discourse.aurelia.io/u/michaelw85)
#### Post date: [January 7, 2020, 8:50pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/4 "2020-01-07T20:50:15Z")

</div>

Quickly looking at the error I would try to turn off source map creation and see if it works without.

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 7, 2020, 9:04pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/5 "2020-01-07T21:04:13Z")

</div>

Good thought but that didn’t solve it

---

<div class="post-metadata">

### Author: ![michaelw85](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/michaelw85/32/1317_2.png) [@michaelw85](https://discourse.aurelia.io/u/michaelw85)
#### Post date: [January 7, 2020, 9:17pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/6 "2020-01-07T21:17:09Z")

</div>

Hmm shame, I will check if I already updated my extension repo. I am actively using 3.7 where I can, I think I also upgraded my component library but will double check and let you know

---

<div class="post-metadata">

### Author: ![ghiscoding](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ghiscoding/32/1199_2.png) [@ghiscoding](https://discourse.aurelia.io/u/ghiscoding)
#### Post date: [January 8, 2020, 3:58am UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/7 "2020-01-08T03:58:25Z")

</div>

I use TS 3.7 with Optional Chaining, but for that I had to modify the `tsconfig.json` Target to `es2020` prior to this I had it set to `esnext` but I read somewhere that it doesn’t work with next (it might in the future) and so try changing it `"target": "es2020",` and that is under the `compilerOptions`. I think you can also target something lower, just don’t use next as it won’t work.

So in my case, I got it working in both the backend (with NestJS) and frontend (Aurelia)

EDIT  
Here’s where I found it, it’s from this [SO](https://stackoverflow.com/a/58725755/1212166) answer that got me going. There’s also a comment which says that you if you do this change then you lose BigInt because it’s not in `es2020` yet but I’m not using that so that is fine by me… oh and your Editor has to support it as well, for the intellisense I think, VSCode always use latest TS so it’s good but it might not work with other Editors.

Hmm actually that is probably not your problem since after re-reading your post, you mention it’s only for plugin build.

---

<div class="post-metadata">

### Author: ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)
#### Post date: [January 8, 2020, 11:00am UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/8 "2020-01-08T11:00:00Z")

</div>

You should check release notes for breaking changes in typescript.

TypeScript team doesn’t follow semver (major version bump for breaking changes). Their argument is that if they bump major version for every release of breaking changes, there will be only major versions because there are always breaking changes due to the complexity of the project.

[https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#37-breaking-changes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#37-breaking-changes)

---

<div class="post-metadata">

### Author: ![michaelw85](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/michaelw85/32/1317_2.png) [@michaelw85](https://discourse.aurelia.io/u/michaelw85)
#### Post date: [January 8, 2020, 12:41pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/9 "2020-01-08T12:41:09Z")

</div>

I’m on ts 3.7.2 for the component library i’m working on which is an aurelia plugin and it’s working just fine. My compiler target is “es5”.

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 8, 2020, 3:56pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/10 "2020-01-08T15:56:01Z")

</div>

Sigh, well it looks like clearing my node\_modules fixed things. Thank you to all that chimed in. I despise NPM

---

<div class="post-metadata">

### Author: ![ghiscoding](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ghiscoding/32/1199_2.png) [@ghiscoding](https://discourse.aurelia.io/u/ghiscoding)
#### Post date: [January 8, 2020, 4:01pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/11 "2020-01-08T16:01:44Z")

</div>

Also just so that all of you know, it is **not recommended** to use TypeScript `3.7.x` in a plugin/lib because the TypeScript team merged this [breaking change](https://github.com/microsoft/TypeScript/issues/33939). I found this bug while using NestJS (nodeJS framework) and they had to downgrade the framework to TS `3.6.x` because I opened a [regression bug](https://github.com/nestjs/nest/issues/3513) in that framework and from what I understand the TS team doesn’t want to budge… the end story of this is that **if** the plugin/lib uses TS `3.7.x` to build their plugin/lib, then it requires **every user** of their plugin/lib to use TS `3.7` or else it breaks for those users and a framework like NestJS cannot afford to do that and so they had to revert to an older TS version `3.6.x` (which kinda sux).

It’s most probably not really related to your issue, but it’s totally worth to know about.

BTW, the bug (or regression) in question is that it changes the signature of the compiled `d.ts` file, it adds a `get` in front of every getter while it wasn’t doing that in previous version. For example, prior to `3.7`the `d.ts` would have

```auto
axiosRef(): AxiosInstance

```

with `3.7` and up it’s now (notice the `get` in the front)

```auto
get axiosRef(): AxiosInstance

```

then if you have a TS version lower than `3.7` (like `3.6`), you will get this new breaking error

```bash
node_modules/@nestjs/common/http/http.service.d.ts:13:9 - 
error TS1086: An accessor cannot be declared in an ambient context.
13 get axiosRef(): AxiosInstance;
           ~~~~~~~~

```

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 8, 2020, 4:03pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/12 "2020-01-08T16:03:31Z")

</div>

That is great info and should be well documented on the plugin page. For me it’s not an issue thankfully as my plugins are all private

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 8, 2020, 5:25pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/13 "2020-01-08T17:25:55Z")

</div>

2 of my plugin projects are good, the 3rd, which relies on Syncfusion javascript controls has this issue. I’m not sure if this is what is breaking the build, I can’t just remove it as the plugin’s purpose is to wrap them.

As long as I keep that one project using some older TS, i should be okay. My consuming project is okay at 3.7.4

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 8, 2020, 5:45pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/14 "2020-01-08T17:45:19Z")

</div>

How can I target older TS version in only one project??

---

<div class="post-metadata">

### Author: ![ghiscoding](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ghiscoding/32/1199_2.png) [@ghiscoding](https://discourse.aurelia.io/u/ghiscoding)
#### Post date: [January 8, 2020, 9:17pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/15 "2020-01-08T21:17:54Z")

</div>

I’m not sure if you understand what I wrote about the “not recommended” to use TS `3.7` for plugin/lib. It’s mostly to still be compatible for users who have not upgraded to latest TS, but if you are using TS `3.7` then you shouldn’t have that problem, as long as you don’t target `esnext` which doesn’t work for Optional Chaining. I think there can only be 1 target per project since it uses 1 `tsconfig` file.

What is the error that you’re getting anyway?

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 9, 2020, 1:12pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/16 "2020-01-09T13:12:51Z")

</div>

I understood exactly what you meant. My issue isn’t the same as what you ran into, but one of my imported libraries has an issue with 3.7.x so I need to drop down to the previous version.

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 10, 2020, 1:14pm UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/19 "2020-01-10T13:14:50Z")

</div>

Syncfusion said they’ll have a fix coming out next week for this issue.

---

<div class="post-metadata">

### Author: ![ghiscoding](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ghiscoding/32/1199_2.png) [@ghiscoding](https://discourse.aurelia.io/u/ghiscoding)
#### Post date: [January 12, 2020, 4:57am UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/20 "2020-01-12T04:57:39Z")

</div>

I’m not sure if you use Syncfusion for the grid, but if it’s for the grid, you should take a look at my lib [Aurelia-Slickgrid](https://github.com/ghiscoding/aurelia-slickgrid) it’s so much better and there’s no issue with TS `3.7` 😉

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [January 12, 2020, 5:44am UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/21 "2020-01-12T05:44:14Z")

</div>

I’m too far along to just switch.

I’ve eliminated all jQuery code from my project. Not a great reason to not use it, so it really comes down I don’t have time to switch grids

---

<div class="post-metadata">

### Author: ![timfish](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/timfish/32/1566_2.png) [@timfish](https://discourse.aurelia.io/u/timfish)
#### Post date: [January 15, 2020, 10:41am UTC](https://discourse.aurelia.io/t/typescript-3-7-broke-plugin-builds/3141/22 "2020-01-15T10:41:43Z")

</div>

> [@ghiscoding](#):
>
> I had to modify the `tsconfig.json` Target to `es2020`

Not sure if you’re aware but the target compiler option tells Typescript what level of JavaScript to transpile to. If you target es2020 and use optional chaining, your output code will still contain optional chaining and will not work in Firefox or Safari unless you are transpiling again after [Optional chaining (?.) - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)
