Files
react/packages/react-client/src/ReactFlightClientStreamConfigNode.js
Lauren Tan 0d36faf38c [flow] Upgrade from 0.280 -> 0.281
Major changes in Flow 0.281:
- $FlowFixMe comments now require explicit error codes (e.g., $FlowFixMe[incompatible-type])
- Changed all bare $FlowFixMe to include appropriate error codes
- Changed $FlowIgnore to $FlowFixMe where needed
- Fixed stream types to have cancel() return Promise<void> instead of void
- Added pseudoElement property to KeyframeEffect type
- Added suppressions for Proxy handler variance issues
- Fixed various type errors across the codebase
2025-12-08 13:07:15 -08:00

33 lines
717 B
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {TextDecoder} from 'util';
export type StringDecoder = TextDecoder;
export function createStringDecoder(): StringDecoder {
return new TextDecoder();
}
const decoderOptions: {stream?: boolean, ...} = {stream: true};
export function readPartialStringChunk(
decoder: StringDecoder,
buffer: Uint8Array,
): string {
return decoder.decode(buffer, decoderOptions);
}
export function readFinalStringChunk(
decoder: StringDecoder,
buffer: Uint8Array,
): string {
return decoder.decode(buffer);
}