browserify / node-util

node.js util module as a module
MIT License
247 stars 88 forks source link

TextEncoder / TextDecoder are missing #82

Open ecofi opened 8 months ago

ecofi commented 8 months ago

util.TextEncoder and util.TextDecoder are missing. Any chance for including this?

ljharb commented 8 months ago

I’d love to review a PR.

bcruddy commented 6 months ago

It looks like they're there now but typescript doesn't like the TextDecoder implementation

Type 'typeof TextDecoder' is not assignable to type '{ new (label?: string | undefined, options?: TextDecoderOptions | undefined): TextDecoder; prototype: TextDecoder; }'.
  The types of 'prototype.decode' are incompatible between these types.
    Type '(input?: ArrayBufferView | ArrayBuffer | null | undefined, options?: { stream?: boolean | undefined; } | undefined) => string' is not assignable to type '(input?: AllowSharedBufferSource | undefined, options?: TextDecodeOptions | undefined) => string'.
      Types of parameters 'input' and 'input' are incompatible.
        Type 'AllowSharedBufferSource | undefined' is not assignable to type 'ArrayBufferView | ArrayBuffer | null | undefined'.
          Type 'ArrayBufferView' is not assignable to type 'ArrayBufferView | ArrayBuffer | null | undefined'.
            Type 'ArrayBufferView' is missing the following properties from type 'DataView': getFloat32, getFloat64, getInt8, getInt16, and 17 more.ts(2322)
ljharb commented 6 months ago

@bcruddy this package still doesn't have them, node does.