Fork-ts-checker-webpack-plugin: wrong declarations - Initializers are not allowed in ambient contexts.

Created on 10 Dec 2018  路  11Comments  路  Source: TypeStrong/fork-ts-checker-webpack-plugin

due to error in typescript 3.1 https://github.com/Microsoft/TypeScript/issues/28230

there is an error in your d.ts files

node_modules/fork-ts-checker-webpack-plugin/lib/index.d.ts:37:44 - error TS1039: Initializers are not allowed in ambient contexts.

37     static readonly DEFAULT_MEMORY_LIMIT = 2048;
                                              ~~~~

when I fixed typescript version to 3.0.3 in your project, declarations are correct.

now in package.json you have ^3.0.1 and 3.1.6 in yarn.lock it has to be changes to 3.0.3

3.2.2 can't compile due to

src/IncrementalChecker.ts:250:43 - error TS2345: Argument of type 'ReadonlyArray<Diagnostic>' is not assignable to parameter of type 'Diagnostic[]'.
  Type 'ReadonlyArray<Diagnostic>' is missing the following properties from type 'Diagnostic[]': pop, push, reverse, shift, and 6 more.

250       diagnostics.push.apply(diagnostics, diagnosticsToRegister);
                                              ~~~~~~~~~~~~~~~~~~~~~


Found 1 error.
bug

All 11 comments

Presumably this only impacts users who make use of the .d.ts files?

We won't be locking the plugin to a older version of TypeScript. If you'd like to submit a PR that remedies this in another way that would be great!

3.2.2 can't compile due to

Should be fixed by https://github.com/Realytics/fork-ts-checker-webpack-plugin/pull/189 hopefully.

damn you were faster :) maybe next time I'll win this PR race ;)

Published as https://github.com/Realytics/fork-ts-checker-webpack-plugin/releases/tag/v0.5.1

Though I'm guessing the .d.ts error may remain? It still could be your time to shine!

I'm actually getting this same error. The docs say that typescript 2.1 is the minimum working version of Typescript, and I'm using 2.8. Is that accurate?

Yes

Any idea why I'd be seeing this error then? I'm unable to use this tool at all unless I upgrade to something like Typescript 3.1.1, but unfortunately that breaks some other stuff. I'd love to be able to use it.

Do you need to write your webpack.config.js in TypeScript? As I understand it, it's just that that's hindering you?

Any updates on this issue? We are using the .d.ts file and this error still remains. Should we submit PR to this repo to fix it??

Sure!

@maciejw , @oozliuoo
Please try fork-ts-checker-webpack-plugin@alpha - I've published a new version which should resolve this issue 馃殌
I will close this issue to clean-up the backlog. If this release didn't solve the issue, we can re-open this :)

Was this page helpful?
0 / 5 - 0 ratings