Definitelytyped: [@types/text-encoding] Incompat with TS 2.8+

Created on 3 Apr 2018  路  1Comment  路  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/xxxx package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @pine

Seems text-encoding type definition is incompatible with TypeScript 2.8.1, I got the compilation error:

(52,13): Subsequent variable declarations must have the same type.  Variable 'TextDecoder' must be of type '{ new (label?: string | undefined, options?: TextDecoderOptions | undefined): TextDecoder; protot...', but here has type 'TextDecoderStatic'

both declare var TextDecoder and declare var TextEncoder are erroneous.

btw @pine san, please update the definition by section when fixing this

Most helpful comment

Finally found out that TS 2.8 has provided built-in TextEncoder and TextDecoder interfaces in lib.dom.d.ts, thus making conflicts.
The solution is to remove @types/text-encoding

>All comments

Finally found out that TS 2.8 has provided built-in TextEncoder and TextDecoder interfaces in lib.dom.d.ts, thus making conflicts.
The solution is to remove @types/text-encoding

Was this page helpful?
0 / 5 - 0 ratings