You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ yarn flow --message-width 80
yarn run v1.22.10
$ /tmp/tmp.fTIX2thXuc/node_modules/.bin/flow --message-width 80
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ index.js:4:18
Cannot get util.TextEncoder because property TextEncoder (did you mean
TextDecoder?) is missing in module util [1]. [prop-missing]
index.js
1│ // @flow
2│ const util = require("util");
3│ console.log(util.TextDecoder);
4│ console.log(util.TextEncoder);
5│
../flow/flowlib_812ef1ce4cab4593_1000/node.js
[1] 2262│ declare module "util" {
2263│ declare function debuglog(section: string): (data: any, ...args: any) => void;
2264│ declare function format(format: string, ...placeholders: any): string;
2265│ declare function log(string: string): void;
2266│ declare function inspect(object: any, options?: util$InspectOptions): string;
2267│ declare function isArray(object: any): boolean;
2268│ declare function isRegExp(object: any): boolean;
2269│ declare function isDate(object: any): boolean;
2270│ declare function isError(object: any): boolean;
2271│ declare function inherits(constructor: Function, superConstructor: Function): void;
2272│ declare function deprecate(f: Function, string: string): Function;
2273│ declare function promisify(f: Function): Function;
2274│ declare function callbackify(f: Function): Function;
2275│
2276│ declare class TextDecoder {
2277│ constructor(encoding?: string, options: {
2278│ fatal?: boolean,
2279│ ignoreBOM?: boolean,
2280│ ...
2281│ }): void;
2282│ decode(input?: ArrayBuffer | DataView | $TypedArray, options?: { stream?: boolean, ... }): string;
2283│ encoding: string;
2284│ fatal: boolean;
2285│ ignoreBOM: boolean;
2286│ }
2287│
2288│ declare class TextEncoder {
2289│ constructor(): void;
2290│ encode(input?: string): Uint8Array;
2291│ encoding: string;
2292│ }
2293│ }
Found 1 error
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Note that TextEncoderis declared, right after TextDecoder, as is
visible in the error trace. Both were added in #7713, first released in
v0.101.0; I can reproduce at that Flow version, too (and at v0.100.0 it
complains on both of them, as expected).
Flow version: 0.145.0
Steps to reproduce
Brand new Yarn package with only
flow-bin
installed. Inindex.js
:This is a straightforward use of the Node APIs, and works:
Expected behavior
It should type-check.
Actual behavior
Note that
TextEncoder
is declared, right afterTextDecoder
, as isvisible in the error trace. Both were added in #7713, first released in
v0.101.0; I can reproduce at that Flow version, too (and at v0.100.0 it
complains on both of them, as expected).
Can repro on Node 10 and Node 14.
Cannot repro on Flow Try (no such module
util
).h/t @topocount for raising this issue
The text was updated successfully, but these errors were encountered: