TargetProcess/tauCharts

Broken with TypeScript v2.6.0

Closed this issue · 5 comments

When trying to compile with TypeScript v2.6.2 I get the following error:

Failed to compile.

[at-loader] ./node_modules/taucharts/types/index.d.ts:302:16 
    TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context.

Which refers to these lines in index.d.ts:

export default {
    Plot,
    Chart,
    api,
    version,
};

This is a breaking change in Typescript 2.6.0+: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts

Are there any work arounds in the interim?

I've just noticed that you guys are actually using typescript 2.7.2 in the dev dependencies, so I don't quite know how you guys are able to compile?? ¯\(ツ)

I've been able to fix it by replacing the default export with this:

declare var _default: {
  Plot: typeof Plot,
  Chart: typeof Chart,
  api: typeof api,
  version: typeof version,
}

export default _default;

I'll submit a PR with this fix in it shortly. The only reason I can think of for it perhaps not to be showing up for others using typescript@2.7.2 is a possible compiler regression that has stopped flagging it as an issue?

👍

@alexanderby wait for you to come back, dude.