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

Major Improvements 2 #12

Merged
merged 3 commits into from
Jul 1, 2022
Merged

Conversation

graphemecluster
Copy link
Contributor

Sorry for another PR! Unlike the previous (closed) one, this PR should be mergeable without any external actions required.

This PR brings type safety to typed array and extends #7 to the find and findIndex methods.

Introduces a single utility type CheckNonNullable, which is unnecessary with the type of o being replaced to {} after TypeScript 4.8 due to microsoft/TypeScript#49119.

The first parameter of {Array, %TypedArray%}.from are all renamed to source because writing iterable: Iterable<T> | ArrayLike<T> is kind of misleading, and it is also named source in the spec text.

This PR does not include tests for methods with only thisArg changes, or it will be superfluous.

I think some bugs like this: void in the original library files should be reported to TypeScript, and I am surprised that the return type of the first parameter of the %TypedArray%.prototype methods in the original es2020.bigint.d.ts file are already typed boolean, in contrast to the Array.prototype methods in es5.d.ts.

generated/lib.es5.d.ts Outdated Show resolved Hide resolved
@graphemecluster
Copy link
Contributor Author

I hope the generation code could be rewritten such that the files are transformed and emitted using the API instead of printing the statements one by one by text. This way it will be far easier to maintain the code, and the code can even be written such that we need not to repeat the documentations in the lib files.
However I don’t want to modify the generation logic too much, unless you explicitly allow me to do so (and the main reason is that I haven’t got the time).

@graphemecluster
Copy link
Contributor Author

Do you wish that I commit the VSCode launch.json for debugging?

Copy link
Owner

@uhyo uhyo left a comment

Choose a reason for hiding this comment

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

Thank you!

This way it will be far easier to maintain the code, and the code can even be written such that we need not to repeat the documentations in the lib files.

Yes that'd be nice, although I haven't come up with a nice way of achieving this 🤕

Do you wish that I commit the VSCode launch.json for debugging?

Yes that's fine 🙂

@uhyo
Copy link
Owner

uhyo commented Jul 1, 2022

Thank you, sorry for being late 🤕

@uhyo uhyo merged commit 2bcb317 into uhyo:master Jul 1, 2022
@graphemecluster
Copy link
Contributor Author

Don't forget to publish a new release whenever you're free! 😉

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