node-util icon indicating copy to clipboard operation
node-util copied to clipboard

TextEncoder / TextDecoder are missing

Open ecofi opened this issue 1 year ago • 4 comments

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

ecofi avatar Mar 13 '24 11:03 ecofi

I’d love to review a PR.

ljharb avatar Mar 13 '24 15:03 ljharb

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)

bcruddy avatar May 22 '24 15:05 bcruddy

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

ljharb avatar May 22 '24 15:05 ljharb