-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@types/readable-stream] Fix StringDecoder type usage in readable-stream #37869
[@types/readable-stream] Fix StringDecoder type usage in readable-stream #37869
Conversation
StringDecoder is a value, but used as type. This gives an error ('StringDecoder' refers to a value, but is being used as a type here.) when trying to build. Add 'typeof' to fix this
👋 Hi there! I’ve run some quick performance metrics against master and your PR. This is still an experiment, so don’t panic if I say something crazy! I’m still learning how to interpret these metrics. Let’s review the numbers, shall we? Comparison details 📊
It looks like nothing changed too much. I’m pretty lenient since I’m still an experiment, so take a look anyways and make sure nothing looks out of place. If you have any questions or comments about me, you can ping |
@JonathanCA97 Thank you for submitting this PR! 🔔 @TeamworkGuy2 - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
Hi, thanks for your answer
The node version I use is 10.13.0 |
If I follow the reference of StringDecoder, I come to this code:
|
I'm guessing you're using version After investigating, I see the following issue between v10 and v12 of declare module "string_decoder" {
interface NodeStringDecoder {
write(buffer: Buffer): string;
end(buffer?: Buffer): string;
}
const StringDecoder: {
new(encoding?: string): NodeStringDecoder;
};
}
declare module "string_decoder" {
class StringDecoder {
constructor(encoding?: string);
write(buffer: Buffer): string;
end(buffer?: Buffer): string;
}
} |
Using @types/node V12 fixes it indeed, thanks! |
After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience! |
StringDecoder is a value, but used as type. This gives an error ('StringDecoder' refers to a value, but is being used as a type here.) when trying to build. Add 'typeof' to fix this