Skip to content
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

fix(io/buffer): super and initialized prop #1917

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

kitsonk
Copy link
Contributor

@kitsonk kitsonk commented Feb 14, 2022

This gets rid of the error messages like the following when using io/buffer.ts under tsc directly via dnt:

TS2376: A 'super' call must be the first statement in the constructor when a class contains initialized properties, parameter properties, or private identifiers.

While this is being fixed in future version of TypeScript, it is a limitation that is easy to work around and allows people to use the std lib via dnt without type errors.

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I was actually seeing the same error while using dnt

@kt3k
Copy link
Member

kt3k commented Feb 14, 2022

@kitsonk I'm in favor of this change, but I'm not sure why this is ok in std and causes type error when using dnt transformation. Can this be somehow tested in std's CI?

@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 14, 2022

@kt3k no, because it only occurs when using tsc directly and not targeting esnext. The fix is in TypeScript 4.6, and this is the PR that fixed it: microsoft/TypeScript#29374. You cannot force Deno to typecheck in non-esnext mode. The only way to manifest this would be to run some sort of process the converts everything via dnt to "node" code and then runs tsc against it, and I see that seperate to this PR if such a thing is desired.

@kitsonk
Copy link
Contributor Author

kitsonk commented Feb 14, 2022

I

@kitsonk I'm in favor of this change, but I'm not sure why this is ok in std and causes type error when using dnt transformation. Can this be somehow tested in std's CI?

I opened #1918 to cover this.

@kitsonk kitsonk merged commit a9f6a1c into denoland:main Feb 14, 2022
@kitsonk kitsonk deleted the super_first branch February 14, 2022 04:03
@kt3k
Copy link
Member

kt3k commented Feb 14, 2022

Thanks for the explanation and creating the issue!

microsoft/TypeScript#29374.

Oh, that birthday cake PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants